diff options
Diffstat (limited to 'vendor/thiserror/src/display.rs')
-rw-r--r-- | vendor/thiserror/src/display.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/thiserror/src/display.rs b/vendor/thiserror/src/display.rs new file mode 100644 index 000000000..0eb0dd9e2 --- /dev/null +++ b/vendor/thiserror/src/display.rs @@ -0,0 +1,28 @@ +use std::fmt::Display; +use std::path::{self, Path, PathBuf}; + +pub trait DisplayAsDisplay { + fn as_display(&self) -> Self; +} + +impl<T: Display> DisplayAsDisplay for &T { + fn as_display(&self) -> Self { + self + } +} + +pub trait PathAsDisplay { + fn as_display(&self) -> path::Display<'_>; +} + +impl PathAsDisplay for Path { + fn as_display(&self) -> path::Display<'_> { + self.display() + } +} + +impl PathAsDisplay for PathBuf { + fn as_display(&self) -> path::Display<'_> { + self.display() + } +} |