Enum rkyv::option::ArchivedOption
source · #[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_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>>
pub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>>
Converts from Pin<&ArchivedOption<T>>
to Option<Pin<&T>>
.
sourcepub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>>
pub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>>
Converts from Pin<&mut ArchivedOption<T>>
to Option<Pin<&mut T>>
.
sourcepub const fn iter(&self) -> Iter<'_, T> ⓘ
pub const fn iter(&self) -> Iter<'_, T> ⓘ
Returns an iterator over the possibly contained value.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Returns a mutable iterator over the 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: 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: Archive, D: Fallible + ?Sized> Deserialize<Option<T>, D> for ArchivedOption<T::Archived>where
T::Archived: Deserialize<T, D>,
impl<T: Archive, D: Fallible + ?Sized> Deserialize<Option<T>, D> for ArchivedOption<T::Archived>where
T::Archived: Deserialize<T, D>,
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<T: Ord> Ord for ArchivedOption<T>
impl<T: Ord> Ord for ArchivedOption<T>
source§impl<T: PartialEq<U>, U> PartialEq<ArchivedOption<T>> for Option<U>
impl<T: PartialEq<U>, U> PartialEq<ArchivedOption<T>> for Option<U>
source§fn eq(&self, other: &ArchivedOption<T>) -> bool
fn eq(&self, other: &ArchivedOption<T>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<T, U: PartialEq<T>> PartialEq<Option<T>> for ArchivedOption<U>
impl<T, U: PartialEq<T>> PartialEq<Option<T>> for ArchivedOption<U>
source§impl<T: PartialEq> PartialEq for ArchivedOption<T>
impl<T: PartialEq> PartialEq for ArchivedOption<T>
source§impl<T: PartialOrd> PartialOrd for ArchivedOption<T>
impl<T: PartialOrd> PartialOrd for ArchivedOption<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more