From 041a1f2a8e7ffd377678d8b757467a14059d55ef Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 22 May 2023 13:39:01 +0200 Subject: [PATCH] gstreamer: message: implement Display on Error, Warning and Info Part-of: --- gstreamer/src/message.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 5df97fa2f..5ff7b8ec6 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -388,6 +388,12 @@ impl Error { } } +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.error()) + } +} + declare_concrete_message!(Warning, T); impl Warning { #[doc(alias = "gst_message_new_warning")] @@ -458,6 +464,12 @@ impl Warning { } } +impl std::fmt::Display for Warning { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.error()) + } +} + declare_concrete_message!(Info, T); impl Info { #[doc(alias = "gst_message_new_info")] @@ -528,6 +540,12 @@ impl Info { } } +impl std::fmt::Display for Info { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.error()) + } +} + declare_concrete_message!(Tag, T); impl Tag { #[doc(alias = "gst_message_new_tag")]