Enum rkyv::core_impl::ArchivedOption [−][src]
#[repr(u8)] pub enum ArchivedOption<T> { None, Some(T), }
An archived Option
.
It functions identically to Option
but has a different internal
representation to allow for archiving.
Variants
No value
Some value T
Implementations
impl<T> ArchivedOption<T>
[src]
impl<T> ArchivedOption<T>
[src]pub fn is_none(&self) -> bool
[src]
Returns true
if the option is a None
value.
pub fn is_some(&self) -> bool
[src]
Returns true
if the option is a Some
value.
pub fn as_ref(&self) -> Option<&T>
[src]
Converts to an Option<&T>
.
pub fn as_mut(&mut self) -> Option<&mut T>
[src]
Converts to an Option<&mut T>
.
pub fn get_or_insert(&mut self, v: T) -> &mut T
[src]
Inserts v
into the option if it is None
, then returns a mutable
reference to the contained value.
pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T
[src]
Inserts a value computed from f
into the option if it is None
, then
returns a mutable reference to the contained value.
Trait Implementations
impl<C: ?Sized, T: CheckBytes<C>> CheckBytes<C> for ArchivedOption<T>
[src]
impl<C: ?Sized, T: CheckBytes<C>> CheckBytes<C> for ArchivedOption<T>
[src]type Error = ArchivedOptionError<T::Error>
The error that may result from checking the type.
unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
[src]
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
impl<T: Eq> Eq for ArchivedOption<T>
[src]
impl<T: Eq> Eq for ArchivedOption<T>
[src]impl<T: Hash> Hash for ArchivedOption<T>
[src]
impl<T: Hash> Hash for ArchivedOption<T>
[src]impl<T: Ord> Ord for ArchivedOption<T>
[src]
impl<T: Ord> Ord for ArchivedOption<T>
[src]impl<T: PartialEq> PartialEq<ArchivedOption<T>> for ArchivedOption<T>
[src]
impl<T: PartialEq> PartialEq<ArchivedOption<T>> for ArchivedOption<T>
[src]impl<T, U: PartialEq<T>> PartialEq<Option<T>> for ArchivedOption<U>
[src]
impl<T, U: PartialEq<T>> PartialEq<Option<T>> for ArchivedOption<U>
[src]impl<T: PartialOrd> PartialOrd<ArchivedOption<T>> for ArchivedOption<T>
[src]
impl<T: PartialOrd> PartialOrd<ArchivedOption<T>> for ArchivedOption<T>
[src]Auto Trait Implementations
impl<T> RefUnwindSafe for ArchivedOption<T> where
T: RefUnwindSafe,
impl<T> RefUnwindSafe for ArchivedOption<T> where
T: RefUnwindSafe,
impl<T> Send for ArchivedOption<T> where
T: Send,
impl<T> Send for ArchivedOption<T> where
T: Send,
impl<T> Sync for ArchivedOption<T> where
T: Sync,
impl<T> Sync for ArchivedOption<T> where
T: Sync,
impl<T> Unpin for ArchivedOption<T> where
T: Unpin,
impl<T> Unpin for ArchivedOption<T> where
T: Unpin,
impl<T> UnwindSafe for ArchivedOption<T> where
T: UnwindSafe,
impl<T> UnwindSafe for ArchivedOption<T> where
T: UnwindSafe,
Blanket Implementations
impl<T> ArchivePointee for T
[src]
impl<T> ArchivePointee for T
[src]type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
[src]
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata