about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-12T14·44+0300
committertazjin <tazjin@tvl.su>2022-08-27T09·27+0000
commite33eaa2cb59cda63d1ae034d5bb00c3bf1fd435e (patch)
tree759f0d4979f9fa5ede2799b25fb75823c711586d /tvix/eval/src
parent1d86c4537ea9e693e497407972b23d47bab53969 (diff)
feat(tvix/eval): add Path representation to Value enum r/4515
Change-Id: I4827384201912131ea8fc2362188dcd862b94852
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6181
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/value/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index 3889a79835c3..5360f0cc7d56 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -1,7 +1,7 @@
 //! This module implements the backing representation of runtime
 //! values in the Nix language.
-use std::fmt::Display;
 use std::rc::Rc;
+use std::{fmt::Display, path::PathBuf};
 
 mod attrs;
 mod list;
@@ -19,6 +19,7 @@ pub enum Value {
     Integer(i64),
     Float(f64),
     String(NixString),
+    Path(PathBuf),
     Attrs(Rc<NixAttrs>),
     List(NixList),
 
@@ -45,6 +46,7 @@ impl Value {
             Value::Integer(_) => "int",
             Value::Float(_) => "float",
             Value::String(_) => "string",
+            Value::Path(_) => "path",
             Value::Attrs(_) => "set",
             Value::List(_) => "list",
 
@@ -106,6 +108,7 @@ impl Display for Value {
             Value::Bool(false) => f.write_str("false"),
             Value::Integer(num) => write!(f, "{}", num),
             Value::String(s) => s.fmt(f),
+            Value::Path(p) => p.display().fmt(f),
             Value::Attrs(attrs) => attrs.fmt(f),
             Value::List(list) => list.fmt(f),