Struct rkyv::niche::option_box::ArchivedOptionBox [−][src]
#[repr(transparent)]pub struct ArchivedOptionBox<T: ArchivePointee + ?Sized> { /* fields omitted */ }Expand description
A niched archived Option<Box<T>>.
It uses less space by storing the None variant as a null pointer.
Implementations
Converts to an Option<&ArchivedBox<T>>.
Converts to an Option<&mut ArchivedBox<T>>.
Converts from Pin<&ArchivedOptionBox<T>> to Option<Pin<&ArchivedBox<T>>>.
Converts from Pin<&mut ArchivedOption<T>> to Option<Pin<&mut ArchivedBox<T>>>.
Returns an iterator over the possibly contained value.
Returns a mutable iterator over the possibly contained value.
pub 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
posmust be the position ofoutwithin the archiveresolvermust be the result of serializingfield
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,
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
impl<T: ArchivePointee + ?Sized> Debug for ArchivedOptionBox<T> where
T::ArchivedMetadata: Debug,
impl<T: ArchivePointee + ?Sized> Debug for ArchivedOptionBox<T> where
T::ArchivedMetadata: Debug,
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,
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,
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.
impl<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,
impl<T: ArchivePointee + PartialEq + ?Sized> PartialEq<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
impl<T: ArchivePointee + PartialEq + ?Sized> PartialEq<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
impl<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,
impl<T: ArchivePointee + PartialOrd + ?Sized> PartialOrd<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
impl<T: ArchivePointee + PartialOrd + ?Sized> PartialOrd<ArchivedOptionBox<T>> for ArchivedOptionBox<T>
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
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
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more