about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-12-12T14·57+0300
committertazjin <tazjin@tvl.su>2022-12-21T22·37+0000
commit0ef3c2fc2beb65b594de2ebc2574776b20205494 (patch)
treef3cc9d9e6ed609b2b9a622476d9294dba8774a52 /tvix/eval/src/vm.rs
parentc3c4d752c91f64eff8e7f7f7b21fbcc1209d27a6 (diff)
refactor(tvix/eval): use EvalIO::read_to_string in impure builtins r/5460
With this change, the behaviour of reading a string from a file path
is controlled by the provided `EvalIO` structure.

This is a huge step towards abstracting away I/O behaviour correctly.

Change-Id: Ifde8e46cd863b16e0301dca45a434ad27560399f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7567
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/vm.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index baf594f936..fcbbe61909 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -220,6 +220,11 @@ impl<'o> VM<'o> {
         self.chunk().get_span(self.frame().ip - 1)
     }
 
+    /// Access the I/O handle used for filesystem access in this VM.
+    pub(crate) fn io(&self) -> &Box<dyn EvalIO> {
+        &self.io_handle
+    }
+
     /// Returns the information needed to calculate the current span,
     /// but without performing that calculation.
     fn current_light_span(&self) -> LightSpan {