From 3a9432f4d890579044f8507e8d7ae02e798c63b1 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 1 May 2024 20:22:06 +0300 Subject: feat(tvix/castore/path): impl AsRef for Path This allows using both Path and PathBuf in a function argument taking `impl AsRef`. Change-Id: Ibd3ba6fac538069d2fe729d1ef399fdef301668f Reviewed-on: https://cl.tvl.fyi/c/depot/+/11574 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: Connor Brewster --- tvix/castore/src/path.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tvix/castore/src/path.rs') 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 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. -- cgit 1.4.1