about summary refs log tree commit diff
path: root/tvix/eval/src/value/list.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-09T14·08+0300
committerclbot <clbot@tvl.fyi>2022-08-13T15·35+0000
commitc67747cbe126649057e47f2f4756645a553e682e (patch)
tree7dfabb036df54145d2b0eb0336ad53b494a43aa0 /tvix/eval/src/value/list.rs
parent6f13c16f28de01209c92e9b9415b68b00b913894 (diff)
feat(tvix/value): add runtime representation of simple lists r/4429
There might be more logic in the future to encapsulate different
backing implementations of lists as well.

Change-Id: Ib7064fab48bf88b0c8913b0ecfa2108177c7c9fd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6093
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/value/list.rs')
-rw-r--r--tvix/eval/src/value/list.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs
new file mode 100644
index 000000000000..08f56262e00c
--- /dev/null
+++ b/tvix/eval/src/value/list.rs
@@ -0,0 +1,14 @@
+/// This module implements Nix lists.
+use std::fmt::Display;
+
+use super::Value;
+
+#[derive(Clone, Debug, PartialEq)]
+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()))
+    }
+}