GstPipelineStudio/src/macros.rs
Stéphane Cerveau 6756b34919 plugindialogs: rename module and support properties in element
rename pluginlist module to plugindialogs
Add display_plugin_properties to modify properties
from an element.
Add a way to modify the location if element is URI_TYPE_SRC
Able to remove a node from the graph
2022-01-11 20:48:53 +01:00

34 lines
773 B
Rust

// Macro for upgrading a weak reference or returning the given value
//
// This works for glib/gtk objects as well as anything else providing an upgrade method
macro_rules! upgrade_weak {
($x:ident, $r:expr) => {{
match $x.upgrade() {
Some(o) => o,
None => return $r,
}
}};
($x:ident) => {
upgrade_weak!($x, ())
};
}
macro_rules! str_some_value (
($value:expr, $t:ty) => (
{
let value = $value.get::<$t>().expect("ser_some_value macro");
value
}
);
);
macro_rules! str_opt_value (
($value:expr, $t:ty) => (
{
match $value.get::<$t>() {
Ok(v) => Some(v),
Err(_e) => None
}
}
);
);