diff --git a/gstreamer-validate/src/action.rs b/gstreamer-validate/src/action.rs index 3a5678db4..4b9d2640d 100644 --- a/gstreamer-validate/src/action.rs +++ b/gstreamer-validate/src/action.rs @@ -1,5 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::ffi::CStr; + use glib::prelude::*; use glib::translate::*; @@ -55,6 +57,13 @@ impl Action { } } + pub fn name(&self) -> &str { + unsafe { + let action: *mut ffi::GstValidateAction = self.to_glib_none().0; + CStr::from_ptr((*action).name).to_str().unwrap() + } + } + #[doc(alias = "gst_validate_execute_action")] pub fn execute(&self) -> Result { unsafe { @@ -71,3 +80,12 @@ impl Action { } } } + +impl std::fmt::Debug for Action { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("Action") + .field("structure", &self.structure()) + .field("name", &self.name()) + .finish() + } +}