diff options
author | Florian Klink <flokli@flokli.de> | 2024-01-16T12·19+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-01-18T09·09+0000 |
commit | e0a867cabff021348cc283b25467cfd40b8eb15a (patch) | |
tree | 9b4f1fd63460ba8385b38259481a7bb32363801b /tvix/eval/src/vm/generators.rs | |
parent | 44d24852c3c62320cb2a4c9b9627e744c518f207 (diff) |
refactor(tvix/eval): generalize EvalIO container r/7407
Don't restrict to a Box<dyn EvalIO>. There's still one or two places where we do restrict, this will be solved by b/262. Change-Id: Ic8d927d6ea81fa12d90b1e4352f35ffaafbd1adf Reviewed-on: https://cl.tvl.fyi/c/depot/+/10639 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/eval/src/vm/generators.rs')
-rw-r--r-- | tvix/eval/src/vm/generators.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/eval/src/vm/generators.rs b/tvix/eval/src/vm/generators.rs index f2ce73a0c742..3d2fd9d266c7 100644 --- a/tvix/eval/src/vm/generators.rs +++ b/tvix/eval/src/vm/generators.rs @@ -224,7 +224,10 @@ pub fn pin_generator( Box::pin(f) } -impl<'o> VM<'o> { +impl<'o, IO> VM<'o, IO> +where + IO: AsRef<dyn EvalIO> + 'static, +{ /// Helper function to re-enqueue the current generator while it /// is awaiting a value. fn reenqueue_generator(&mut self, name: &'static str, span: LightSpan, generator: Generator) { @@ -411,6 +414,7 @@ impl<'o> VM<'o> { VMRequest::PathImport(path) => { let imported = self .io_handle + .as_ref() .import_path(&path) .map_err(|e| ErrorKind::IO { path: Some(path), @@ -424,6 +428,7 @@ impl<'o> VM<'o> { VMRequest::ReadToString(path) => { let content = self .io_handle + .as_ref() .read_to_string(&path) .map_err(|e| ErrorKind::IO { path: Some(path), @@ -437,6 +442,7 @@ impl<'o> VM<'o> { VMRequest::PathExists(path) => { let exists = self .io_handle + .as_ref() .path_exists(&path) .map_err(|e| ErrorKind::IO { path: Some(path), @@ -451,6 +457,7 @@ impl<'o> VM<'o> { VMRequest::ReadDir(path) => { let dir = self .io_handle + .as_ref() .read_dir(&path) .map_err(|e| ErrorKind::IO { path: Some(path), |