pub struct Maybe<'a> { /* private fields */ }
Expand description
A helper type to wrap OptionValue
.
API is provided to convert from, and to Option
Implementations
sourceimpl<'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
.
Trait Implementations
sourceimpl<'a> From<Maybe<'a>> for OwnedValue
impl<'a> From<Maybe<'a>> for OwnedValue
sourceimpl<'a> TryFrom<&'a OwnedValue> for &'a Maybe<'a>
impl<'a> TryFrom<&'a OwnedValue> for &'a Maybe<'a>
sourceimpl TryFrom<OwnedValue> for Maybe<'static>
impl TryFrom<OwnedValue> for Maybe<'static>
impl<'a> StructuralPartialEq for Maybe<'a>
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more