about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/castore/src/proto/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tvix/castore/src/proto/mod.rs b/tvix/castore/src/proto/mod.rs
index 5374e3ae5a80..a0cec896f753 100644
--- a/tvix/castore/src/proto/mod.rs
+++ b/tvix/castore/src/proto/mod.rs
@@ -116,9 +116,11 @@ impl NamedNode for node::Node {
 impl Node {
     /// Ensures the node has a valid enum kind (is Some), and passes its
     // per-enum validation.
-    pub fn validate(&self) -> Result<(), ValidateNodeError> {
+    // The inner root node is returned for easier consumption.
+    pub fn validate(&self) -> Result<&node::Node, ValidateNodeError> {
         if let Some(node) = self.node.as_ref() {
-            node.validate()
+            node.validate()?;
+            Ok(node)
         } else {
             Err(ValidateNodeError::NoNodeSet)
         }