about summary refs log tree commit diff
path: root/tvix/eval/src/value/list.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value/list.rs')
-rw-r--r--tvix/eval/src/value/list.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs
index f9d85229410a..546d2c88a55a 100644
--- a/tvix/eval/src/value/list.rs
+++ b/tvix/eval/src/value/list.rs
@@ -4,7 +4,7 @@ use std::fmt::Display;
 use super::Value;
 
 #[derive(Clone, Debug, PartialEq)]
-pub struct NixList(pub Vec<Value>);
+pub struct NixList(Vec<Value>);
 
 impl Display for NixList {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -26,4 +26,15 @@ impl NixList {
         lhs.0.append(&mut rhs.0);
         lhs
     }
+
+    pub fn construct(count: usize, stack_slice: Vec<Value>) -> Self {
+        debug_assert!(
+            count == stack_slice.len(),
+            "NixList::construct called with count == {}, but slice.len() == {}",
+            count,
+            stack_slice.len(),
+        );
+
+        NixList(stack_slice)
+    }
 }