diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-09T14·50+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-08-13T18·28+0000 |
commit | 2dcbbb8c4a737483fcd2133411ef425299a741fd (patch) | |
tree | 3970590b7ee0bfd2f1348da9ef73f5a44b1de42e | |
parent | 56caaf70ca3d136b033c9d6e4ff811c52b554c12 (diff) |
feat(tvix/value): implement Display properly for lists r/4436
Change-Id: I991d235cf52fbd42eb839b384f9c55ee64fa86c4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6100 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
-rw-r--r-- | tvix/eval/src/value/list.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs index 08f56262e00c..d5f7c8b2ba44 100644 --- a/tvix/eval/src/value/list.rs +++ b/tvix/eval/src/value/list.rs @@ -8,7 +8,13 @@ pub struct NixList(pub Vec<Value>); impl Display for NixList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - // TODO(tazjin): format lists properly - f.write_fmt(format_args!("<list({})>", self.0.len())) + f.write_str("[ ")?; + + for v in &self.0 { + v.fmt(f)?; + f.write_str(" ")?; + } + + f.write_str("]") } } |