mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 02:51:10 +00:00
validate: Implement Debug trait on Action
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1586>
This commit is contained in:
parent
dcf6d333b6
commit
721de958ce
1 changed files with 18 additions and 0 deletions
|
@ -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<crate::ActionSuccess, crate::ActionError> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue