Struct rkyv::niche::option_box::ArchivedOptionBox
source · [−]#[repr(transparent)]pub struct ArchivedOptionBox<T: ArchivePointee + ?Sized> { /* private fields */ }
Expand description
A niched archived Option<Box<T>>
.
It uses less space by storing the None
variant as a null pointer.
Implementations
sourceimpl<T: ArchivePointee + ?Sized> ArchivedOptionBox<T>
impl<T: ArchivePointee + ?Sized> ArchivedOptionBox<T>
sourcepub fn as_ref(&self) -> Option<&ArchivedBox<T>>
pub fn as_ref(&self) -> Option<&ArchivedBox<T>>
Converts to an Option<&ArchivedBox<T>>
.
sourcepub fn as_mut(&mut self) -> Option<&mut ArchivedBox<T>>
pub fn as_mut(&mut self) -> Option<&mut ArchivedBox<T>>
Converts to an Option<&mut ArchivedBox<T>>
.
sourcepub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&ArchivedBox<T>>>
pub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&ArchivedBox<T>>>
Converts from Pin<&ArchivedOptionBox<T>>
to Option<Pin<&ArchivedBox<T>>>
.
sourcepub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut ArchivedBox<T>>>
pub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut ArchivedBox<T>>>
Converts from Pin<&mut ArchivedOption<T>>
to Option<Pin<&mut ArchivedBox<T>>>
.
sourcepub fn iter(&self) -> Iter<'_, ArchivedBox<T>>
pub fn iter(&self) -> Iter<'_, ArchivedBox<T>>
Returns an iterator over the possibly contained value.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, ArchivedBox<T>>
pub fn iter_mut(&mut self) -> IterMut<'_, ArchivedBox<T>>
Returns a mutable iterator over the possibly contained value.
sourceimpl<T: ArchivePointee + ?Sized> ArchivedOptionBox<T> where
T::ArchivedMetadata: Default,
impl<T: ArchivePointee + ?Sized> ArchivedOptionBox<T> where
T::ArchivedMetadata: Default,
sourcepub unsafe fn resolve_from_option<U: ArchiveUnsized<Archived = T> + ?Sized>(
field: Option<&U>,
pos: usize,
resolver: OptionBoxResolver<U::MetadataResolver>,
out: *mut Self
)
pub unsafe fn resolve_from_option<U: ArchiveUnsized<Archived = T> + ?Sized>(
field: Option<&U>,
pos: usize,
resolver: OptionBoxResolver<U::MetadataResolver>,
out: *mut Self
)
Resolves an ArchivedOptionBox<T::Archived>
from an Option<&T>
.
Safety
pos
must be the position ofout
within the archiveresolver
must be the result of serializingfield
sourcepub fn serialize_from_option<U, S>(
field: Option<&U>,
serializer: &mut S
) -> Result<OptionBoxResolver<U::MetadataResolver>, S::Error> where
U: SerializeUnsized<S, Archived = T> + ?Sized,
S: Serializer + ?Sized,
pub fn serialize_from_option<U, S>(
field: Option<&U>,
serializer: &mut S
) -> Result<OptionBoxResolver<U::MetadataResolver>, S::Error> where
U: SerializeUnsized<S, Archived = T> + ?Sized,
S: Serializer + ?Sized,
Serializes an ArchivedOptionBox<T::Archived>
from an Option<&T>
.
Trait Implementations
sourceimpl<T: ArchivePointee + ?Sized> Debug for ArchivedOptionBox<T> where
T::ArchivedMetadata: Debug,
impl<T: ArchivePointee + ?Sized> Debug for ArchivedOptionBox<T> where
T::ArchivedMetadata: Debug,
sourceimpl<T, D> DeserializeWith<ArchivedOptionBox<<T as ArchiveUnsized>::Archived>, Option<Box<T, Global>>, D> for Niche where
T: ArchiveUnsized + ?Sized,
T::Archived: DeserializeUnsized<T, D>,
D: Fallible + ?Sized,
impl<T, D> DeserializeWith<ArchivedOptionBox<<T as ArchiveUnsized>::Archived>, Option<Box<T, Global>>, D> for Niche where
T: ArchiveUnsized + ?Sized,
T::Archived: DeserializeUnsized<T, D>,
D: Fallible + ?Sized,
sourcefn deserialize_with(
field: &ArchivedOptionBox<T::Archived>,
deserializer: &mut D
) -> Result<Option<Box<T>>, D::Error>
fn deserialize_with(
field: &ArchivedOptionBox<T::Archived>,
deserializer: &mut D
) -> Result<Option<Box<T>>, D::Error>
Deserializes the field type F
using the given deserializer.
sourceimpl<T: ArchivePointee + Hash + ?Sized> Hash for ArchivedOptionBox<T>
impl<T: ArchivePointee + Hash + ?Sized> Hash for ArchivedOptionBox<T>
sourceimpl<T: ArchivePointee + Ord + ?Sized> Ord for ArchivedOptionBox<T>
impl<T: ArchivePointee + Ord + ?Sized> Ord for ArchivedOptionBox<T>
sourceimpl<T, U> PartialEq<ArchivedOptionBox<T>> for Option<Box<U>> where
T: ArchivePointee + PartialEq<U> + ?Sized,
U: ?Sized,
impl<T, U> PartialEq<ArchivedOptionBox<T>> for Option<Box<U>> where
T: ArchivePointee + PartialEq<U> + ?Sized,
U: ?Sized,
sourceimpl<T: ArchivePointee + PartialEq + ?Sized> PartialEq<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
impl<T: ArchivePointee + PartialEq + ?Sized> PartialEq<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
sourceimpl<T, U> PartialEq<Option<Box<T, Global>>> for ArchivedOptionBox<U> where
T: ?Sized,
U: ArchivePointee + PartialEq<T> + ?Sized,
impl<T, U> PartialEq<Option<Box<T, Global>>> for ArchivedOptionBox<U> where
T: ?Sized,
U: ArchivePointee + PartialEq<T> + ?Sized,
sourceimpl<T: ArchivePointee + PartialOrd + ?Sized> PartialOrd<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
impl<T: ArchivePointee + PartialOrd + ?Sized> PartialOrd<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T: ArchivePointee + Eq + ?Sized> Eq for ArchivedOptionBox<T>
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ArchivedOptionBox<T> where
T: RefUnwindSafe,
<T as ArchivePointee>::ArchivedMetadata: RefUnwindSafe,
impl<T: ?Sized> Send for ArchivedOptionBox<T> where
T: Send,
<T as ArchivePointee>::ArchivedMetadata: Send,
impl<T: ?Sized> Sync for ArchivedOptionBox<T> where
T: Sync,
<T as ArchivePointee>::ArchivedMetadata: Sync,
impl<T> !Unpin for ArchivedOptionBox<T>
impl<T: ?Sized> UnwindSafe for ArchivedOptionBox<T> where
T: UnwindSafe,
<T as ArchivePointee>::ArchivedMetadata: UnwindSafe,
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
fn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more