merge and print strings like strings, rather than arrays

This commit is contained in:
gluax 2021-05-20 12:50:49 -04:00
parent 947f13b77b
commit c4a1bd6955

View File

@ -99,6 +99,13 @@ impl<'a, F: PrimeField, G: GroupType<F>> fmt::Display for ConstrainedValue<'a, F
// Data type wrappers
ConstrainedValue::Array(ref array) => {
if matches!(array[0], ConstrainedValue::Char(_)) {
for character in array {
write!(f, "{}", character)?;
}
Ok(())
} else {
write!(f, "[")?;
for (i, e) in array.iter().enumerate() {
write!(f, "{}", e)?;
@ -108,6 +115,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> fmt::Display for ConstrainedValue<'a, F
}
write!(f, "]")
}
}
ConstrainedValue::Tuple(ref tuple) => {
let values = tuple.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(", ");