1 use std::fmt::Display; 2 use std::path::{self, Path, PathBuf}; 3 4 pub trait DisplayAsDisplay { as_display(&self) -> Self5 fn as_display(&self) -> Self; 6 } 7 8 impl<T: Display> DisplayAsDisplay for &T { as_display(&self) -> Self9 fn as_display(&self) -> Self { 10 self 11 } 12 } 13 14 pub trait PathAsDisplay { as_display(&self) -> path::Display<'_>15 fn as_display(&self) -> path::Display<'_>; 16 } 17 18 impl PathAsDisplay for Path { as_display(&self) -> path::Display<'_>19 fn as_display(&self) -> path::Display<'_> { 20 self.display() 21 } 22 } 23 24 impl PathAsDisplay for PathBuf { as_display(&self) -> path::Display<'_>25 fn as_display(&self) -> path::Display<'_> { 26 self.display() 27 } 28 } 29