Skip to content

Commit 0005794

Browse files
committed
Add to_path_buf() method for RelPath
1 parent a41cec9 commit 0005794

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/paths/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,11 @@ impl RelPath {
305305
pub fn new_unchecked(path: &Path) -> &RelPath {
306306
unsafe { &*(path as *const Path as *const RelPath) }
307307
}
308+
309+
/// Equivalent of [`Path::to_path_buf`] for `RelPath`.
310+
pub fn to_path_buf(&self) -> RelPathBuf {
311+
RelPathBuf::try_from(self.0.to_path_buf()).unwrap()
312+
}
308313
}
309314

310315
/// Taken from <https://github.com/rust-lang/cargo/blob/79c769c3d7b4c2cf6a93781575b7f592ef974255/src/cargo/util/paths.rs#L60-L85>

0 commit comments

Comments
 (0)