#[repr(u8)]pub enum ArchivedOption<T> {
None,
Some(T),
}
Expand description
Variants§
Implementations§
Source§impl<T> ArchivedOption<T>
impl<T> ArchivedOption<T>
Sourcepub fn ok_or<E>(self, err: E) -> Result<T, E>
pub fn ok_or<E>(self, err: E) -> Result<T, E>
Transforms the ArchivedOption<T>
into a Result<T, E>
, mapping
Some(v)
to Ok(v)
and None
to Err(err)
.
Sourcepub fn unwrap_or(self, default: T) -> T
pub fn unwrap_or(self, default: T) -> T
Returns the contained Some
value or a provided default.
Sourcepub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T
pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T
Returns the contained Some
value or computes it from a closure.
Sourcepub fn as_seal(this: Seal<'_, Self>) -> Option<Seal<'_, T>>
pub fn as_seal(this: Seal<'_, Self>) -> Option<Seal<'_, T>>
Converts from Seal<'_, ArchivedOption<T>>
to Option<Seal<'_, T>>
.
Sourcepub fn iter_mut(&mut self) -> Iter<&mut T> ⓘ
pub fn iter_mut(&mut self) -> Iter<&mut T> ⓘ
Returns an iterator over the mutable possibly-contained value.
Sourcepub fn iter_seal(this: Seal<'_, Self>) -> Iter<Seal<'_, T>> ⓘ
pub fn iter_seal(this: Seal<'_, Self>) -> Iter<Seal<'_, T>> ⓘ
Returns an iterator over the sealed possibly-contained value.
Sourcepub fn get_or_insert(&mut self, v: T) -> &mut T
pub fn get_or_insert(&mut self, v: T) -> &mut T
Inserts v
into the option if it is None
, then returns a mutable
reference to the contained value.
Sourcepub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T
pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T
Inserts a value computed from f
into the option if it is None
, then
returns a mutable reference to the contained value.
Source§impl<T: Deref> ArchivedOption<T>
impl<T: Deref> ArchivedOption<T>
Source§impl<T: DerefMut> ArchivedOption<T>
impl<T: DerefMut> ArchivedOption<T>
Sourcepub fn as_deref_mut(&mut self) -> Option<&mut <T as Deref>::Target>
pub fn as_deref_mut(&mut self) -> Option<&mut <T as Deref>::Target>
Converts from &mut ArchivedOption<T>
to Option<&mut T::Target>
.
Leaves the original ArchivedOption
in-place, creating a new Option
with a mutable reference to the inner type’s Deref::Target
type.
Trait Implementations§
Source§impl<T, __C: Fallible + ?Sized> CheckBytes<__C> for ArchivedOption<T>
impl<T, __C: Fallible + ?Sized> CheckBytes<__C> for ArchivedOption<T>
Source§impl<T: Clone> Clone for ArchivedOption<T>
impl<T: Clone> Clone for ArchivedOption<T>
Source§fn clone(&self) -> ArchivedOption<T>
fn clone(&self) -> ArchivedOption<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Debug> Debug for ArchivedOption<T>
impl<T: Debug> Debug for ArchivedOption<T>
Source§impl<T, D> Deserialize<Option<T>, D> for ArchivedOption<T::Archived>
impl<T, D> Deserialize<Option<T>, D> for ArchivedOption<T::Archived>
Source§impl<A, O, D> DeserializeWith<ArchivedOption<<A as ArchiveWith<O>>::Archived>, Option<O>, D> for Map<A>where
D: Fallible + ?Sized,
A: ArchiveWith<O> + DeserializeWith<<A as ArchiveWith<O>>::Archived, O, D>,
impl<A, O, D> DeserializeWith<ArchivedOption<<A as ArchiveWith<O>>::Archived>, Option<O>, D> for Map<A>where
D: Fallible + ?Sized,
A: ArchiveWith<O> + DeserializeWith<<A as ArchiveWith<O>>::Archived, O, D>,
Source§fn deserialize_with(
field: &ArchivedOption<<A as ArchiveWith<O>>::Archived>,
d: &mut D,
) -> Result<Option<O>, D::Error>
fn deserialize_with( field: &ArchivedOption<<A as ArchiveWith<O>>::Archived>, d: &mut D, ) -> Result<Option<O>, D::Error>
F
using the given deserializer.Source§impl<T> From<T> for ArchivedOption<T>
impl<T> From<T> for ArchivedOption<T>
Source§impl<T: Hash> Hash for ArchivedOption<T>
impl<T: Hash> Hash for ArchivedOption<T>
Source§impl<'a, T> IntoIterator for &'a ArchivedOption<T>
impl<'a, T> IntoIterator for &'a ArchivedOption<T>
Source§impl<'a, T> IntoIterator for &'a mut ArchivedOption<T>
impl<'a, T> IntoIterator for &'a mut ArchivedOption<T>
Source§impl<T: Ord> Ord for ArchivedOption<T>
impl<T: Ord> Ord for ArchivedOption<T>
Source§impl<T: PartialEq> PartialEq for ArchivedOption<T>
impl<T: PartialEq> PartialEq for ArchivedOption<T>
Source§impl<T, U: PartialOrd<T>> PartialOrd<Option<T>> for ArchivedOption<U>
impl<T, U: PartialOrd<T>> PartialOrd<Option<T>> for ArchivedOption<U>
Source§impl<T: PartialOrd> PartialOrd for ArchivedOption<T>
impl<T: PartialOrd> PartialOrd for ArchivedOption<T>
impl<T: Copy> Copy for ArchivedOption<T>
impl<T: Eq> Eq for ArchivedOption<T>
impl<T> Portable for ArchivedOption<T>where
T: Portable,
Auto Trait Implementations§
impl<T> Freeze for ArchivedOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for ArchivedOption<T>where
T: RefUnwindSafe,
impl<T> Send for ArchivedOption<T>where
T: Send,
impl<T> Sync for ArchivedOption<T>where
T: Sync,
impl<T> Unpin for ArchivedOption<T>where
T: Unpin,
impl<T> UnwindSafe for ArchivedOption<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.