Struct gstreamer_net::Value
source · pub struct Value(_, _);Expand description
A generic value capable of carrying various types.
Once created the type of the value can’t be changed.
Some types (e.g. String and objects) support None values while others
(e.g. numeric types) don’t.
Value does not implement the Send trait, but SendValue can be
used instead.
See the module documentation for more details.
Implementations
sourceimpl Value
impl Value
sourcepub fn downcast<'a, T>(self) -> Result<TypedValue<T>, Value>where
T: FromValueOptional<'a> + SetValue,
pub fn downcast<'a, T>(self) -> Result<TypedValue<T>, Value>where
T: FromValueOptional<'a> + SetValue,
Tries to downcast to a TypedValue.
Returns Ok(TypedValue<T>) if the value carries a type corresponding
to T and Err(self) otherwise.
sourcepub fn downcast_ref<'a, T>(&self) -> Option<&TypedValue<T>>where
T: FromValueOptional<'a> + SetValue,
pub fn downcast_ref<'a, T>(&self) -> Option<&TypedValue<T>>where
T: FromValueOptional<'a> + SetValue,
Tries to downcast to a &TypedValue.
Returns Some(&TypedValue<T>) if the value carries a type corresponding
to T and None otherwise.
sourcepub fn get<'a, T>(&'a self) -> Option<T>where
T: FromValueOptional<'a>,
pub fn get<'a, T>(&'a self) -> Option<T>where
T: FromValueOptional<'a>,
Tries to get a value of type T.
Returns Some if the type is correct and the value is not None.
This function doesn’t distinguish between type mismatches and correctly
typed None values. Use downcast or is for that.
sourcepub fn is<'a, T>(&self) -> boolwhere
T: FromValueOptional<'a> + SetValue,
pub fn is<'a, T>(&self) -> boolwhere
T: FromValueOptional<'a> + SetValue,
Returns true if the type of the value corresponds to T
or is a sub-type of T.
sourcepub fn type_transformable(src: Type, dst: Type) -> bool
pub fn type_transformable(src: Type, dst: Type) -> bool
Returns whether Values of type src can be transformed to type dst.