From 8f0470ae27d38e006dbb11dfb395fd309353f44c Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Thu, 25 Sep 2025 10:33:11 +0200 Subject: [PATCH] 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. --- glib/src/variant.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/glib/src/variant.rs b/glib/src/variant.rs index edde050db596..544f1c844bae 100644 --- a/glib/src/variant.rs +++ b/glib/src/variant.rs @@ -106,6 +106,7 @@ use std::{ cmp::Ordering, collections::{BTreeMap, HashMap}, fmt, + fmt::Display, hash::{BuildHasher, Hash, Hasher}, mem, ptr, slice, str, }; @@ -2021,6 +2022,12 @@ impl ObjectPath { } } +impl Display for ObjectPath { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} + impl std::ops::Deref for ObjectPath { type Target = str;