about summary refs log tree commit diff
path: root/tvix/castore/src/path.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-05-01T17·22+0300
committerclbot <clbot@tvl.fyi>2024-05-01T19·10+0000
commit3a9432f4d890579044f8507e8d7ae02e798c63b1 (patch)
tree03c6a8f6a099a4d4016bf78e06f5cc2f1a3317f2 /tvix/castore/src/path.rs
parentea7b334a626a7b9235b858598560add6f5efe1c1 (diff)
feat(tvix/castore/path): impl AsRef<Path> for Path r/8063
This allows using both Path and PathBuf in a function argument taking
`impl AsRef<Path>`.

Change-Id: Ibd3ba6fac538069d2fe729d1ef399fdef301668f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11574
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to '')
-rw-r--r--tvix/castore/src/path.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/castore/src/path.rs b/tvix/castore/src/path.rs
index 498f9a91b0..68e4b75ec8 100644
--- a/tvix/castore/src/path.rs
+++ b/tvix/castore/src/path.rs
@@ -117,6 +117,12 @@ impl Display for Path {
     }
 }
 
+impl AsRef<Path> for Path {
+    fn as_ref(&self) -> &Path {
+        self
+    }
+}
+
 /// Represents a owned PathBuf in the castore model.
 /// These are always relative, and platform-independent, which distinguishes
 /// them from the ones provided in the standard library.