[−][src]Struct gstreamer::structure::Structure
A Structure
is a collection of key/value pairs. The keys are expressed
as GQuarks and the values can be of any GType.
In addition to the key/value pairs, a Structure
also has a name. The name
starts with a letter and can be filled by letters, numbers and any of "/-_.:".
Structure
is used by various GStreamer subsystems to store information
in a flexible and extensible way. A Structure
does not have a refcount
because it usually is part of a higher level object such as Caps
,
Message
, Event
, Query
. It provides a means to enforce mutability
using the refcount of the parent with the Structure::set_parent_refcount
method.
A Structure
can be created with Structure::new_empty
or
Structure::new
, which both take a name and an optional set of
key/value pairs along with the types of the values.
Field values can be changed with Structure::set_value
or
Structure::set
.
Field values can be retrieved with Structure::get_value
or the more
convenient gst_structure_get_*() functions.
Fields can be removed with Structure::remove_field
or
Structure::remove_fields
.
Strings in structures must be ASCII or UTF-8 encoded. Other encodings are
not allowed. Strings may be None
however.
Be aware that the current Caps
/ Structure
serialization into string
has limited support for nested Caps
/ Structure
fields. It can only
support one level of nesting. Using more levels will lead to unexpected
behavior when using serialization features, such as Caps::to_string
or
gst_value_serialize
and their counterparts.
Methods
impl Structure
[src]
pub fn builder(name: &str) -> Builder
[src]
pub fn new_empty(name: &str) -> Structure
[src]
Creates a new, empty Structure
with the given name
.
See Structure::set_name
for constraints on the name
parameter.
Free-function: gst_structure_free
name
name of new structure
Returns
a new, empty Structure
pub fn new(name: &str, values: &[(&str, &dyn ToSendValue)]) -> Structure
[src]
Creates a new Structure
with the given name. Parses the
list of variable arguments and sets fields to the values listed.
Variable arguments should be passed as field name, field type,
and value. Last variable argument should be None
.
Free-function: gst_structure_free
name
name of new structure
firstfield
name of first field to set
Returns
a new Structure
pub unsafe fn into_ptr(self) -> *mut GstStructure
[src]
Methods from Deref<Target = StructureRef>
pub unsafe fn as_ptr(&self) -> *const GstStructure
[src]
pub unsafe fn as_mut_ptr(&self) -> *mut GstStructure
[src]
pub fn get<'structure, 'name, T: FromValueOptional<'structure>>(
&'structure self,
name: &'name str
) -> Result<Option<T>, GetError<'name>>
[src]
&'structure self,
name: &'name str
) -> Result<Option<T>, GetError<'name>>
pub fn get_optional<'structure, 'name, T: FromValueOptional<'structure>>(
&'structure self,
name: &'name str
) -> Result<Option<T>, GetError<'name>>
[src]
&'structure self,
name: &'name str
) -> Result<Option<T>, GetError<'name>>
pub fn get_some<'structure, 'name, T: FromValue<'structure>>(
&'structure self,
name: &'name str
) -> Result<T, GetError<'name>>
[src]
&'structure self,
name: &'name str
) -> Result<T, GetError<'name>>
pub fn get_value<'structure, 'name>(
&'structure self,
name: &'name str
) -> Result<&SendValue, GetError<'name>>
[src]
&'structure self,
name: &'name str
) -> Result<&SendValue, GetError<'name>>
pub fn set<T: ToSendValue>(&mut self, name: &str, value: &T)
[src]
pub fn set_value(&mut self, name: &str, value: SendValue)
[src]
pub fn get_name(&self) -> &str
[src]
pub fn set_name(&mut self, name: &str)
[src]
pub fn has_field(&self, field: &str) -> bool
[src]
pub fn has_field_with_type(&self, field: &str, type_: Type) -> bool
[src]
pub fn remove_field(&mut self, field: &str)
[src]
pub fn remove_fields(&mut self, fields: &[&str])
[src]
pub fn remove_all_fields(&mut self)
[src]
pub fn fields(&self) -> FieldIterator
[src]
pub fn iter(&self) -> Iter
[src]
pub fn get_nth_field_name(&self, idx: u32) -> Option<&str>
[src]
pub fn n_fields(&self) -> u32
[src]
pub fn can_intersect(&self, other: &StructureRef) -> bool
[src]
pub fn intersect(&self, other: &StructureRef) -> Option<Structure>
[src]
pub fn is_subset(&self, superset: &StructureRef) -> bool
[src]
pub fn fixate(&mut self)
[src]
pub fn fixate_field(&mut self, name: &str) -> bool
[src]
pub fn fixate_field_bool(&mut self, name: &str, target: bool) -> bool
[src]
pub fn fixate_field_str(&mut self, name: &str, target: &str) -> bool
[src]
pub fn fixate_field_nearest_double(&mut self, name: &str, target: f64) -> bool
[src]
pub fn fixate_field_nearest_fraction<T: Into<Fraction>>(
&mut self,
name: &str,
target: T
) -> bool
[src]
&mut self,
name: &str,
target: T
) -> bool
pub fn fixate_field_nearest_int(&mut self, name: &str, target: i32) -> bool
[src]
Trait Implementations
impl AsMut<StructureRef> for Structure
[src]
fn as_mut(&mut self) -> &mut StructureRef
[src]
impl AsRef<StructureRef> for Structure
[src]
fn as_ref(&self) -> &StructureRef
[src]
impl Borrow<StructureRef> for Structure
[src]
fn borrow(&self) -> &StructureRef
[src]
impl BorrowMut<StructureRef> for Structure
[src]
fn borrow_mut(&mut self) -> &mut StructureRef
[src]
impl Clone for Structure
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Structure
[src]
impl Deref for Structure
[src]
type Target = StructureRef
The resulting type after dereferencing.
fn deref(&self) -> &StructureRef
[src]
impl DerefMut for Structure
[src]
fn deref_mut(&mut self) -> &mut StructureRef
[src]
impl<'de> Deserialize<'de> for Structure
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl Display for Structure
[src]
impl Drop for Structure
[src]
impl Eq for Structure
[src]
impl FromGlibPtrFull<*const GstStructure> for Structure
[src]
unsafe fn from_glib_full(ptr: *const GstStructure) -> Self
[src]
impl FromGlibPtrFull<*mut GstStructure> for Structure
[src]
unsafe fn from_glib_full(ptr: *mut GstStructure) -> Self
[src]
impl FromGlibPtrNone<*const GstStructure> for Structure
[src]
unsafe fn from_glib_none(ptr: *const GstStructure) -> Self
[src]
impl FromGlibPtrNone<*mut GstStructure> for Structure
[src]
unsafe fn from_glib_none(ptr: *mut GstStructure) -> Self
[src]
impl FromStr for Structure
[src]
type Err = BoolError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, BoolError>
[src]
impl<'a> FromValueOptional<'a> for Structure
[src]
unsafe fn from_value_optional(v: &'a Value) -> Option<Self>
[src]
impl GlibPtrDefault for Structure
[src]
type GlibType = *mut GstStructure
impl PartialEq<Structure> for Structure
[src]
impl PartialEq<StructureRef> for Structure
[src]
fn eq(&self, other: &StructureRef) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Send for Structure
[src]
impl Serialize for Structure
[src]
impl SetValue for Structure
[src]
impl SetValueOptional for Structure
[src]
unsafe fn set_value_optional(v: &mut Value, s: Option<&Self>)
[src]
impl StaticType for Structure
[src]
fn static_type() -> Type
[src]
impl Sync for Structure
[src]
impl<'a> ToGlibPtr<'a, *const GstStructure> for Structure
[src]
type Storage = &'a Self
fn to_glib_none(&'a self) -> Stash<'a, *const GstStructure, Self>
[src]
fn to_glib_full(&self) -> *const GstStructure
[src]
fn to_glib_container(&'a self) -> Stash<'a, P, Self>
[src]
impl<'a> ToGlibPtr<'a, *mut GstStructure> for Structure
[src]
type Storage = &'a Self
fn to_glib_none(&'a self) -> Stash<'a, *mut GstStructure, Self>
[src]
fn to_glib_full(&self) -> *mut GstStructure
[src]
fn to_glib_container(&'a self) -> Stash<'a, P, Self>
[src]
impl<'a> ToGlibPtrMut<'a, *mut GstStructure> for Structure
[src]
type Storage = &'a mut Self
fn to_glib_none_mut(&'a mut self) -> StashMut<*mut GstStructure, Self>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GPtrArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GPtrArray
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: ToValue + SetValue + Send + ?Sized,
[src]
T: ToValue + SetValue + Send + ?Sized,
fn to_send_value(&self) -> SendValue
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,