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

None

No value

Some(T)

Some value T

Implementations

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]

type Error = ArchivedOptionError<T::Error>

The error that may result from checking the type.

impl<T: Debug> Debug for ArchivedOption<T>[src]

impl<T: Eq> Eq for ArchivedOption<T>[src]

impl<T: Hash> Hash for ArchivedOption<T>[src]

impl<T: Ord> Ord 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: PartialOrd> PartialOrd<ArchivedOption<T>> for ArchivedOption<T>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> ArchivePointee for T[src]

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointee for T[src]

type Metadata = ()

The type for metadata in pointers and references to Self.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.