Struct rkyv::niche::option_box::ArchivedOptionBox
source · 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§
source§impl<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.
source§impl<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>
pub fn serialize_from_option<U, S>( field: Option<&U>, serializer: &mut S, ) -> Result<OptionBoxResolver<U::MetadataResolver>, S::Error>
Serializes an ArchivedOptionBox<T::Archived>
from an Option<&T>
.
Trait Implementations§
source§impl<T: ArchivePointee + ?Sized> Debug for ArchivedOptionBox<T>where
T::ArchivedMetadata: Debug,
impl<T: ArchivePointee + ?Sized> Debug for ArchivedOptionBox<T>where
T::ArchivedMetadata: Debug,
source§impl<T, D> DeserializeWith<ArchivedOptionBox<<T as ArchiveUnsized>::Archived>, Option<Box<T>>, D> for Niche
impl<T, D> DeserializeWith<ArchivedOptionBox<<T as ArchiveUnsized>::Archived>, Option<Box<T>>, D> for Niche
source§fn 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.source§impl<T: ArchivePointee + Hash + ?Sized> Hash for ArchivedOptionBox<T>
impl<T: ArchivePointee + Hash + ?Sized> Hash for ArchivedOptionBox<T>
source§impl<T: ArchivePointee + Ord + ?Sized> Ord for ArchivedOptionBox<T>
impl<T: ArchivePointee + Ord + ?Sized> Ord for ArchivedOptionBox<T>
source§impl<T, U> PartialEq<ArchivedOptionBox<T>> for Option<Box<U>>
impl<T, U> PartialEq<ArchivedOptionBox<T>> for Option<Box<U>>
source§fn eq(&self, other: &ArchivedOptionBox<T>) -> bool
fn eq(&self, other: &ArchivedOptionBox<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T, U> PartialEq<Option<Box<T>>> for ArchivedOptionBox<U>
impl<T, U> PartialEq<Option<Box<T>>> for ArchivedOptionBox<U>
source§impl<T: ArchivePointee + PartialEq + ?Sized> PartialEq for ArchivedOptionBox<T>
impl<T: ArchivePointee + PartialEq + ?Sized> PartialEq for ArchivedOptionBox<T>
source§impl<T: ArchivePointee + PartialOrd + ?Sized> PartialOrd for ArchivedOptionBox<T>
impl<T: ArchivePointee + PartialOrd + ?Sized> PartialOrd for ArchivedOptionBox<T>
1.0.0 · source§fn 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 moreimpl<T: ArchivePointee + Eq + ?Sized> Eq for ArchivedOptionBox<T>
Auto Trait Implementations§
impl<T> Freeze for ArchivedOptionBox<T>
impl<T> RefUnwindSafe for ArchivedOptionBox<T>
impl<T> Send for ArchivedOptionBox<T>
impl<T> Sync for ArchivedOptionBox<T>
impl<T> !Unpin for ArchivedOptionBox<T>
impl<T> UnwindSafe for ArchivedOptionBox<T>
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more