about summary refs log tree commit diff
path: root/tvix/eval/src/value/builtin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value/builtin.rs')
-rw-r--r--tvix/eval/src/value/builtin.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tvix/eval/src/value/builtin.rs b/tvix/eval/src/value/builtin.rs
index 944efd85eb..bb14265181 100644
--- a/tvix/eval/src/value/builtin.rs
+++ b/tvix/eval/src/value/builtin.rs
@@ -50,6 +50,8 @@ pub struct Builtin {
     name: &'static str,
     /// Array of arguments to the builtin.
     arguments: &'static [BuiltinArgument],
+    /// Optional documentation for the builtin.
+    documentation: Option<&'static str>,
     func: Rc<dyn BuiltinFn>,
 
     /// Partially applied function arguments.
@@ -60,11 +62,13 @@ impl Builtin {
     pub fn new<F: BuiltinFn + 'static>(
         name: &'static str,
         arguments: &'static [BuiltinArgument],
+        documentation: Option<&'static str>,
         func: F,
     ) -> Self {
         Builtin {
             name,
             arguments,
+            documentation,
             func: Rc::new(func),
             partials: vec![],
         }
@@ -74,6 +78,10 @@ impl Builtin {
         self.name
     }
 
+    pub fn documentation(&self) -> Option<&'static str> {
+        self.documentation
+    }
+
     /// Apply an additional argument to the builtin, which will either
     /// lead to execution of the function or to returning a partial
     /// builtin.