about summary refs log tree commit diff
path: root/tvix/eval/src/value/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value/mod.rs')
-rw-r--r--tvix/eval/src/value/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index 0a430ae08cb3..2a89f1c35890 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -71,6 +71,16 @@ impl Value {
             }),
         }
     }
+
+    pub fn as_attrs(self) -> EvalResult<Rc<NixAttrs>> {
+        match self {
+            Value::Attrs(s) => Ok(s),
+            other => Err(Error::TypeError {
+                expected: "set",
+                actual: other.type_of(),
+            }),
+        }
+    }
 }
 
 impl Display for Value {