From 0ef3c2fc2beb65b594de2ebc2574776b20205494 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 12 Dec 2022 17:57:03 +0300 Subject: refactor(tvix/eval): use EvalIO::read_to_string in impure builtins 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 --- tvix/eval/src/vm.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tvix/eval/src/vm.rs') diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs index baf594f9368c..fcbbe619092d 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 { + &self.io_handle + } + /// Returns the information needed to calculate the current span, /// but without performing that calculation. fn current_light_span(&self) -> LightSpan { -- cgit 1.4.1