From 000579477067d43787617c5e44cc02a7246e5cc8 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Tue, 27 Feb 2024 18:33:47 +0100 Subject: [PATCH] Add `to_path_buf()` method for `RelPath` --- crates/paths/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs index db705a7b69ec..a63d251c20d4 100644 --- a/crates/paths/src/lib.rs +++ b/crates/paths/src/lib.rs @@ -305,6 +305,11 @@ impl RelPath { pub fn new_unchecked(path: &Path) -> &RelPath { unsafe { &*(path as *const Path as *const RelPath) } } + + /// Equivalent of [`Path::to_path_buf`] for `RelPath`. + pub fn to_path_buf(&self) -> RelPathBuf { + RelPathBuf::try_from(self.0.to_path_buf()).unwrap() + } } /// Taken from