about summary refs log tree commit diff
path: root/tvix/glue/src/tvix_io.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/glue/src/tvix_io.rs')
-rw-r--r--tvix/glue/src/tvix_io.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/tvix/glue/src/tvix_io.rs b/tvix/glue/src/tvix_io.rs
index 77dcb9291032..19e5dd0b41df 100644
--- a/tvix/glue/src/tvix_io.rs
+++ b/tvix/glue/src/tvix_io.rs
@@ -13,24 +13,27 @@ use std::path::{Path, PathBuf};
 use tvix_eval::{EvalIO, FileType};
 
 // TODO: Merge this together with TvixStoreIO?
-pub struct TvixIO<T: EvalIO> {
+pub struct TvixIO<T> {
     // Actual underlying [EvalIO] implementation.
     actual: T,
 }
 
-impl<T: EvalIO> TvixIO<T> {
+impl<T> TvixIO<T> {
     pub fn new(actual: T) -> Self {
         Self { actual }
     }
 }
 
-impl<T: EvalIO> EvalIO for TvixIO<T> {
+impl<T> EvalIO for TvixIO<T>
+where
+    T: AsRef<dyn EvalIO>,
+{
     fn store_dir(&self) -> Option<String> {
-        self.actual.store_dir()
+        self.actual.as_ref().store_dir()
     }
 
     fn import_path(&self, path: &Path) -> io::Result<PathBuf> {
-        let imported_path = self.actual.import_path(path)?;
+        let imported_path = self.actual.as_ref().import_path(path)?;
         Ok(imported_path)
     }
 
@@ -39,7 +42,7 @@ impl<T: EvalIO> EvalIO for TvixIO<T> {
             return Ok(true);
         }
 
-        self.actual.path_exists(path)
+        self.actual.as_ref().path_exists(path)
     }
 
     fn read_to_string(&self, path: &Path) -> io::Result<String> {
@@ -56,10 +59,10 @@ impl<T: EvalIO> EvalIO for TvixIO<T> {
             return Ok(include_str!("fetchurl.nix").to_string());
         }
 
-        self.actual.read_to_string(path)
+        self.actual.as_ref().read_to_string(path)
     }
 
     fn read_dir(&self, path: &Path) -> io::Result<Vec<(bytes::Bytes, FileType)>> {
-        self.actual.read_dir(path)
+        self.actual.as_ref().read_dir(path)
     }
 }