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