Struct gstreamer::TypedValue
source · pub struct TypedValue<T>(_, _);
Expand description
A statically typed Value
.
It dereferences to Value
and can be used everywhere Value
references are
accepted.
See the module documentation for more details.
Implementations
sourceimpl<'a, T> TypedValue<T>where
T: FromValueOptional<'a> + SetValue,
impl<'a, T> TypedValue<T>where
T: FromValueOptional<'a> + SetValue,
sourcepub fn get(&'a self) -> Option<T>
pub fn get(&'a self) -> Option<T>
Returns the value.
Types that don’t support a None
value always return Some
. See
get_some
.
sourcepub fn get_some(&'a self) -> Twhere
T: FromValue<'a>,
pub fn get_some(&'a self) -> Twhere
T: FromValue<'a>,
Returns the value.
This method is only available for types that don’t support a None
value.
sourcepub fn set<U>(&mut self, value: Option<&U>)where
U: SetValueOptional + ?Sized,
T: Borrow<U>,
pub fn set<U>(&mut self, value: Option<&U>)where
U: SetValueOptional + ?Sized,
T: Borrow<U>,
Sets the value.
This method is only available for types that support a None
value.
sourcepub fn set_none(&mut self)where
T: SetValueOptional,
pub fn set_none(&mut self)where
T: SetValueOptional,
Sets the value to None
.
This method is only available for types that support a None
value.
sourceimpl<'a, T> TypedValue<T>where
T: FromValueOptional<'a> + SetValue + Send,
impl<'a, T> TypedValue<T>where
T: FromValueOptional<'a> + SetValue + Send,
pub fn into_send_value(self) -> SendValue
Methods from Deref<Target = Value>
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
.
Trait Implementations
sourceimpl<T> Clone for TypedValue<T>where
T: Clone,
impl<T> Clone for TypedValue<T>where
T: Clone,
sourcefn clone(&self) -> TypedValue<T>
fn clone(&self) -> TypedValue<T>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more