[−][src]Struct zvariant::Maybe
A helper type to wrap OptionValue
.
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]
T: TryFrom<Value<'a>>,
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]
T: Type + Into<Value<'a>> + Clone,
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]
T: Type + Into<Value<'a>>,
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.
fn try_from(value: &'a Value<'a>) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a Value<'a>> for Maybe<'a>
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(value: &'a Value<'_>) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<Value<'a>> for Maybe<'a>
[src]
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]
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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, 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>,