pub struct Maybe<'a> { /* private fields */ }
Expand description
A helper type to wrap Option<T>
(GVariant’s Maybe type) in Value
.
API is provided to convert from, and to Option<T>
.
Implementations§
source§impl<'a> Maybe<'a>
impl<'a> Maybe<'a>
sourcepub fn nothing<'s: 'a>(value_signature: Signature<'s>) -> Self
pub fn nothing<'s: 'a>(value_signature: Signature<'s>) -> Self
Create a new Nothing (None) Maybe
, given the signature of the type.
sourcepub fn get<T>(self) -> Result<Option<T>, Error>where
T: TryFrom<Value<'a>>,
pub fn get<T>(self) -> Result<Option<T>, Error>where T: TryFrom<Value<'a>>,
Get the inner value as a concrete type
sourcepub fn signature(&self) -> Signature<'static>
pub fn signature(&self) -> Signature<'static>
Get the signature of Maybe
.
NB: This method potentially allocates and copies. Use full_signature
if you’d like to
avoid that.
sourcepub fn full_signature(&self) -> &Signature<'_>
pub fn full_signature(&self) -> &Signature<'_>
Get the signature of Maybe
.
sourcepub fn value_signature(&self) -> &Signature<'_>
pub fn value_signature(&self) -> &Signature<'_>
Get the signature of the potential value in the Maybe
.