about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/eval/src/value.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tvix/eval/src/value.rs b/tvix/eval/src/value.rs
index 699c7de7bc..a4656b1b9c 100644
--- a/tvix/eval/src/value.rs
+++ b/tvix/eval/src/value.rs
@@ -1,6 +1,8 @@
 //! This module implements the backing representation of runtime
 //! values in the Nix language.
 
+use std::fmt::Display;
+
 use crate::errors::{Error, EvalResult};
 
 #[derive(Clone, Copy, Debug, PartialEq)]
@@ -39,3 +41,15 @@ impl Value {
         }
     }
 }
+
+impl Display for Value {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Value::Null => f.write_str("null"),
+            Value::Bool(true) => f.write_str("true"),
+            Value::Bool(false) => f.write_str("false"),
+            Value::Integer(num) => f.write_fmt(format_args!("{}", num)),
+            Value::Float(num) => f.write_fmt(format_args!("{}", num)),
+        }
+    }
+}