about summary refs log tree commit diff
path: root/tvix/glue/src/tvix_store_io.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-10-14T12·51+0300
committerclbot <clbot@tvl.fyi>2024-10-15T17·20+0000
commit330145fa1f05c8df5f8e940441d33edad1d77361 (patch)
treeac0df4f4d068063a94a2e68bfab59cdeacddbce6 /tvix/glue/src/tvix_store_io.rs
parentda8fccba7ae775a762d449aba1828ae7f9bcef35 (diff)
refactor(nix-compat/store_path): use Path in from_absolute_path_full r/8807
These are not necessarily strings, and making it paths allows us to stop
converting them to lossy strings.

Change-Id: I11366c721dc5da1778aafe89092a1966b5a43178
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12617
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Reviewed-by: Jörg Thalheim <joerg@thalheim.io>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/glue/src/tvix_store_io.rs')
-rw-r--r--tvix/glue/src/tvix_store_io.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs
index a09580e9b9ff..7e2ab38d7b6b 100644
--- a/tvix/glue/src/tvix_store_io.rs
+++ b/tvix/glue/src/tvix_store_io.rs
@@ -449,9 +449,7 @@ impl TvixStoreIO {
 impl EvalIO for TvixStoreIO {
     #[instrument(skip(self), ret(level = Level::TRACE), err)]
     fn path_exists(&self, path: &Path) -> io::Result<bool> {
-        if let Ok((store_path, sub_path)) =
-            StorePath::from_absolute_path_full(&path.to_string_lossy())
-        {
+        if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) {
             if self
                 .tokio_handle
                 .block_on(self.store_path_to_node(&store_path, sub_path))?
@@ -471,9 +469,7 @@ impl EvalIO for TvixStoreIO {
 
     #[instrument(skip(self), err)]
     fn open(&self, path: &Path) -> io::Result<Box<dyn io::Read>> {
-        if let Ok((store_path, sub_path)) =
-            StorePath::from_absolute_path_full(&path.to_string_lossy())
-        {
+        if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) {
             if let Some(node) = self
                 .tokio_handle
                 .block_on(async { self.store_path_to_node(&store_path, sub_path).await })?
@@ -527,9 +523,7 @@ impl EvalIO for TvixStoreIO {
 
     #[instrument(skip(self), ret(level = Level::TRACE), err)]
     fn file_type(&self, path: &Path) -> io::Result<FileType> {
-        if let Ok((store_path, sub_path)) =
-            StorePath::from_absolute_path_full(&path.to_string_lossy())
-        {
+        if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) {
             if let Some(node) = self
                 .tokio_handle
                 .block_on(async { self.store_path_to_node(&store_path, sub_path).await })?
@@ -549,9 +543,7 @@ impl EvalIO for TvixStoreIO {
 
     #[instrument(skip(self), ret(level = Level::TRACE), err)]
     fn read_dir(&self, path: &Path) -> io::Result<Vec<(bytes::Bytes, FileType)>> {
-        if let Ok((store_path, sub_path)) =
-            StorePath::from_absolute_path_full(&path.to_string_lossy())
-        {
+        if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(path) {
             if let Some(node) = self
                 .tokio_handle
                 .block_on(async { self.store_path_to_node(&store_path, sub_path).await })?