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_seal(this: Seal<'_, Self>) -> Option<Seal<'_, ArchivedBox<T>>>
pub fn as_seal(this: Seal<'_, Self>) -> Option<Seal<'_, ArchivedBox<T>>>
Converts from Seal<'_, ArchivedOption<T>> to Option<Seal<'_, 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) -> Iter<&mut ArchivedBox<T>>
pub fn iter_mut(&mut self) -> Iter<&mut ArchivedBox<T>>
Returns an iterator over the mutable possibly-contained value.
Source§impl<T: ArchivePointee + ?Sized> ArchivedOptionBox<T>
impl<T: ArchivePointee + ?Sized> ArchivedOptionBox<T>
Sourcepub fn resolve_from_option<U: ArchiveUnsized<Archived = T> + ?Sized>(
field: Option<&U>,
resolver: OptionBoxResolver,
out: Place<Self>,
)
pub fn resolve_from_option<U: ArchiveUnsized<Archived = T> + ?Sized>( field: Option<&U>, resolver: OptionBoxResolver, out: Place<Self>, )
Resolves an ArchivedOptionBox<T::Archived> from an Option<&T>.
Sourcepub fn serialize_from_option<U, S>(
field: Option<&U>,
serializer: &mut S,
) -> Result<OptionBoxResolver, S::Error>
pub fn serialize_from_option<U, S>( field: Option<&U>, serializer: &mut S, ) -> Result<OptionBoxResolver, S::Error>
Serializes an ArchivedOptionBox<T::Archived> from an Option<&T>.
Trait Implementations§
Source§impl<T: ArchivePointee + ?Sized, __C: Fallible + ?Sized> CheckBytes<__C> for ArchivedOptionBox<T>
impl<T: ArchivePointee + ?Sized, __C: Fallible + ?Sized> CheckBytes<__C> for ArchivedOptionBox<T>
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 Nichewhere
T: ArchiveUnsized + LayoutRaw + Pointee + ?Sized,
T::Archived: DeserializeUnsized<T, D>,
D: Fallible + ?Sized,
D::Error: Source,
impl<T, D> DeserializeWith<ArchivedOptionBox<<T as ArchiveUnsized>::Archived>, Option<Box<T>>, D> for Nichewhere
T: ArchiveUnsized + LayoutRaw + Pointee + ?Sized,
T::Archived: DeserializeUnsized<T, D>,
D: Fallible + ?Sized,
D::Error: Source,
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: 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>
impl<T: ArchivePointee + Eq + ?Sized> Eq for ArchivedOptionBox<T>
impl<T: ArchivePointee + ?Sized> Portable for ArchivedOptionBox<T>where
Repr<T>: Portable,
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> !UnsafeUnpin for ArchivedOptionBox<T>
impl<T> UnwindSafe for ArchivedOptionBox<T>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§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
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.