[][src]Struct zvariant::Maybe

pub struct Maybe<'a> { /* fields omitted */ }

A helper type to wrap Option (GVariant's Maybe type) in Value.

API is provided to convert from, and to Option.

Implementations

impl<'a> Maybe<'a>[src]

pub fn inner(&self) -> &Option<Value<'a>>[src]

Get a reference to underlying value.

pub fn just(value: Value<'a>) -> Self[src]

Create a new Just (Some) Maybe.

pub fn nothing<'s: 'a>(value_signature: Signature<'s>) -> Self[src]

Create a new Nothing (None) Maybe, given the signature of the type.

pub fn get<T>(self) -> Result<Option<T>, Error> where
    T: TryFrom<Value<'a>>, 
[src]

Get the inner value as a concrete type

pub fn signature(&self) -> Signature<'static>[src]

Get the signature of Maybe.

pub fn value_signature(&self) -> &Signature<'_>[src]

Get the signature of the potential value in the Maybe.

Trait Implementations

impl<'a> Clone for Maybe<'a>[src]

impl<'a> Debug for Maybe<'a>[src]

impl<'a, T, '_> From<&'_ Option<T>> for Maybe<'a> where
    T: Type + Into<Value<'a>> + Clone
[src]

impl<'a> From<&'a Maybe<'a>> for Value<'a>[src]

impl<'a> From<Maybe<'a>> for Value<'a>[src]

impl<'a, T> From<Option<T>> for Maybe<'a> where
    T: Type + Into<Value<'a>>, 
[src]

impl<'a> PartialEq<Maybe<'a>> for Maybe<'a>[src]

impl<'a> Serialize for Maybe<'a>[src]

impl<'a> StructuralPartialEq for Maybe<'a>[src]

impl<'a> TryFrom<&'a Value<'a>> for &'a Maybe<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a Value<'a>> for Maybe<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Value<'a>> for Maybe<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Maybe<'a>

impl<'a> Send for Maybe<'a>

impl<'a> Sync for Maybe<'a>

impl<'a> Unpin for Maybe<'a>

impl<'a> UnwindSafe for Maybe<'a>

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<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.