Skip to content

Commit 238347b

Browse files
swsnrsdroege
authored andcommitted
Implement Display for ObjectPath
Seems natural since it's just a thin wrapper around String. Let's us do `format!("Object path {path}")` instead of `format!("Object path {}", path.as_str())` which is handy for logging in particular.
1 parent 7b4ffff commit 238347b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

glib/src/variant.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ use std::{
106106
cmp::Ordering,
107107
collections::{BTreeMap, HashMap},
108108
fmt,
109+
fmt::Display,
109110
hash::{BuildHasher, Hash, Hasher},
110111
mem, ptr, slice, str,
111112
};
@@ -2021,6 +2022,12 @@ impl ObjectPath {
20212022
}
20222023
}
20232024

2025+
impl Display for ObjectPath {
2026+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2027+
self.0.fmt(f)
2028+
}
2029+
}
2030+
20242031
impl std::ops::Deref for ObjectPath {
20252032
type Target = str;
20262033

0 commit comments

Comments
 (0)