Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/paths/src/lib.rs')
-rw-r--r--crates/paths/src/lib.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs
index e0c20a4143..88b8d0aee3 100644
--- a/crates/paths/src/lib.rs
+++ b/crates/paths/src/lib.rs
@@ -6,7 +6,7 @@
use std::{
borrow::Borrow,
ffi::OsStr,
- ops,
+ fmt, ops,
path::{Component, Path, PathBuf},
};
@@ -95,6 +95,12 @@ impl AbsPathBuf {
}
}
+impl fmt::Display for AbsPathBuf {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fmt::Display::fmt(&self.0.display(), f)
+ }
+}
+
/// Wrapper around an absolute [`Path`].
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[repr(transparent)]
@@ -217,6 +223,7 @@ impl AbsPath {
pub fn as_os_str(&self) -> &OsStr {
self.0.as_os_str()
}
+ #[deprecated(note = "use Display instead")]
pub fn display(&self) -> std::path::Display<'_> {
self.0.display()
}
@@ -227,6 +234,12 @@ impl AbsPath {
// endregion:delegate-methods
}
+impl fmt::Display for AbsPath {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fmt::Display::fmt(&self.0.display(), f)
+ }
+}
+
/// Wrapper around a relative [`PathBuf`].
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct RelPathBuf(PathBuf);