]> git.proxmox.com Git - rustc.git/blob - vendor/thiserror/src/display.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / vendor / thiserror / src / display.rs
1 use std::fmt::Display;
2 use std::path::{self, Path, PathBuf};
3
4 pub trait DisplayAsDisplay {
5 fn as_display(&self) -> Self;
6 }
7
8 impl<T: Display> DisplayAsDisplay for &T {
9 fn as_display(&self) -> Self {
10 self
11 }
12 }
13
14 pub trait PathAsDisplay {
15 fn as_display(&self) -> path::Display<'_>;
16 }
17
18 impl PathAsDisplay for Path {
19 fn as_display(&self) -> path::Display<'_> {
20 self.display()
21 }
22 }
23
24 impl PathAsDisplay for PathBuf {
25 fn as_display(&self) -> path::Display<'_> {
26 self.display()
27 }
28 }