[][src]Struct glib::variant::Variant

pub struct Variant(_);

A generic immutable value capable of carrying various types.

See the module documentation for more details.

Implementations

impl Variant[src]

pub fn type_(&self) -> &VariantTy[src]

Returns the type of the value.

pub fn is<T: StaticVariantType>(&self) -> bool[src]

Returns true if the type of the value corresponds to T.

pub fn get<T: FromVariant>(&self) -> Option<T>[src]

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]

Tries to extract a &str.

Returns Some if the variant has a string type (s, o or g type strings).

pub fn from_bytes<T: StaticVariantType>(bytes: &Bytes) -> Self[src]

Constructs a new serialised-mode GVariant instance.

pub unsafe fn from_bytes_trusted<T: StaticVariantType>(bytes: &Bytes) -> Self[src]

Constructs a new serialised-mode GVariant instance.

This is the same as from_bytes, except that checks on the passed data are skipped.

You should not use this function on data from external sources.

Safety

Since the data is not validated, this is potentially dangerous if called on bytes which are not guaranteed to have come from serialising another Variant. The caller is responsible for ensuring bad data is not passed in.

pub fn get_data_as_bytes(&self) -> Bytes[src]

Returns the serialised form of a GVariant instance.

Trait Implementations

impl Clone for Variant[src]

impl Debug for Variant[src]

impl Display for Variant[src]

impl Eq for Variant[src]

impl<T: ToVariant> From<T> for Variant[src]

impl From<Variant> for VariantDict[src]

impl Hash for Variant[src]

impl PartialEq<Variant> for Variant[src]

impl PartialOrd<Variant> for Variant[src]

impl Send for Variant[src]

impl StaticType for Variant[src]

impl Sync for Variant[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.