Struct glib::variant::Variant [−][src]
pub struct Variant(_);
A generic immutable value capable of carrying various types.
See the module documentation for more details.
Methods
impl Variant
[src]
impl Variant
pub fn type_(&self) -> &VariantTy
[src]
pub fn type_(&self) -> &VariantTy
Returns the type of the value.
pub fn is<T: StaticVariantType>(&self) -> bool
[src]
pub fn is<T: StaticVariantType>(&self) -> bool
Returns true
if the type of the value corresponds to T
.
pub fn get<T: FromVariant>(&self) -> Option<T>
[src]
pub fn get<T: FromVariant>(&self) -> Option<T>
Tries to extract a value of type T
.
Returns Some
if T
matches the variant's type.
pub fn get_str(&self) -> Option<&str>
[src]
pub fn get_str(&self) -> Option<&str>
Tries to extract a &str
.
Returns Some
if the variant has a string type (s
, o
or g
type
strings).
Trait Implementations
impl Clone for Variant
[src]
impl Clone for Variant
fn clone(&self) -> Variant
[src]
fn clone(&self) -> Variant
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl StaticType for Variant
[src]
impl StaticType for Variant
fn static_type() -> Type
[src]
fn static_type() -> Type
Returns the type identifier of Self
.
impl Send for Variant
[src]
impl Send for Variant
impl Sync for Variant
[src]
impl Sync for Variant
impl Debug for Variant
[src]
impl Debug for Variant
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Variant
[src]
impl Display for Variant
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for Variant
[src]
impl PartialEq for Variant
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Variant
[src]
impl Eq for Variant
impl PartialOrd for Variant
[src]
impl PartialOrd for Variant
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Hash for Variant
[src]
impl Hash for Variant
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: ToVariant> From<T> for Variant
[src]
impl<T: ToVariant> From<T> for Variant