pub struct NichedOption<T, N: ?Sized> { /* private fields */ }Expand description
A niched ArchivedOption<T>.
It has the same layout as T, and thus uses less space by storing the
None variant in a custom way based on N.
Implementations§
Source§impl<T, N: Niching<T> + ?Sized> NichedOption<T, N>
impl<T, N: Niching<T> + ?Sized> NichedOption<T, N>
Sourcepub fn as_seal(this: Seal<'_, Self>) -> Option<Seal<'_, T>>
pub fn as_seal(this: Seal<'_, Self>) -> Option<Seal<'_, T>>
Converts from Seal<'_, NichedOption<T, N>> to Option<Seal<'_, T>>.
Sourcepub fn iter_mut(&mut self) -> Iter<&mut T>
pub fn iter_mut(&mut self) -> Iter<&mut T>
Returns an iterator over the mutable possibly-contained value.
Sourcepub fn iter_seal(this: Seal<'_, Self>) -> Iter<Seal<'_, T>>
pub fn iter_seal(this: Seal<'_, Self>) -> Iter<Seal<'_, T>>
Returns an iterator over the sealed possibly-contained value.
Trait Implementations§
Source§impl<T, N, C> CheckBytes<C> for NichedOption<T, N>
impl<T, N, C> CheckBytes<C> for NichedOption<T, N>
Source§impl<T, N> Debug for NichedOption<T, N>
impl<T, N> Debug for NichedOption<T, N>
Source§impl<T, N, D> Deserialize<Option<T>, D> for NichedOption<T::Archived, N>
impl<T, N, D> Deserialize<Option<T>, D> for NichedOption<T::Archived, N>
Source§impl<T, D> DeserializeWith<NichedOption<<T as Archive>::Archived, DefaultNiche>, Option<T>, D> for DefaultNiche
impl<T, D> DeserializeWith<NichedOption<<T as Archive>::Archived, DefaultNiche>, Option<T>, D> for DefaultNiche
Source§fn deserialize_with(
field: &NichedOption<T::Archived, Self>,
deserializer: &mut D,
) -> Result<Option<T>, D::Error>
fn deserialize_with( field: &NichedOption<T::Archived, Self>, deserializer: &mut D, ) -> Result<Option<T>, D::Error>
Deserializes the field type
F using the given deserializer.Source§impl<T, N, D> DeserializeWith<NichedOption<<T as Archive>::Archived, N>, Option<T>, D> for NicheInto<N>
impl<T, N, D> DeserializeWith<NichedOption<<T as Archive>::Archived, N>, Option<T>, D> for NicheInto<N>
Source§fn deserialize_with(
field: &NichedOption<T::Archived, N>,
deserializer: &mut D,
) -> Result<Option<T>, D::Error>
fn deserialize_with( field: &NichedOption<T::Archived, N>, deserializer: &mut D, ) -> Result<Option<T>, D::Error>
Deserializes the field type
F using the given deserializer.Source§impl<T, W, N, D> DeserializeWith<NichedOption<<W as ArchiveWith<T>>::Archived, N>, Option<T>, D> for MapNiche<W, N>where
W: ArchiveWith<T> + DeserializeWith<<W as ArchiveWith<T>>::Archived, T, D>,
N: Niching<<W as ArchiveWith<T>>::Archived> + ?Sized,
D: Fallible + ?Sized,
impl<T, W, N, D> DeserializeWith<NichedOption<<W as ArchiveWith<T>>::Archived, N>, Option<T>, D> for MapNiche<W, N>where
W: ArchiveWith<T> + DeserializeWith<<W as ArchiveWith<T>>::Archived, T, D>,
N: Niching<<W as ArchiveWith<T>>::Archived> + ?Sized,
D: Fallible + ?Sized,
Source§fn deserialize_with(
field: &NichedOption<<W as ArchiveWith<T>>::Archived, N>,
deserializer: &mut D,
) -> Result<Option<T>, D::Error>
fn deserialize_with( field: &NichedOption<<W as ArchiveWith<T>>::Archived, N>, deserializer: &mut D, ) -> Result<Option<T>, D::Error>
Deserializes the field type
F using the given deserializer.Source§impl<T, N> Ord for NichedOption<T, N>
impl<T, N> Ord for NichedOption<T, N>
Source§impl<T, N, Rhs> PartialEq<Option<Rhs>> for NichedOption<T, N>
impl<T, N, Rhs> PartialEq<Option<Rhs>> for NichedOption<T, N>
Source§impl<T, N> PartialEq for NichedOption<T, N>
impl<T, N> PartialEq for NichedOption<T, N>
Source§impl<T, N> PartialOrd for NichedOption<T, N>
impl<T, N> PartialOrd for NichedOption<T, N>
impl<T, N> Eq for NichedOption<T, N>
impl<T, N: ?Sized> Portable for NichedOption<T, N>
Auto Trait Implementations§
impl<T, N> Freeze for NichedOption<T, N>
impl<T, N> RefUnwindSafe for NichedOption<T, N>
impl<T, N> Send for NichedOption<T, N>
impl<T, N> Sync for NichedOption<T, N>
impl<T, N> Unpin for NichedOption<T, N>
impl<T, N> UnsafeUnpin for NichedOption<T, N>where
T: UnsafeUnpin,
N: ?Sized,
impl<T, N> UnwindSafe for NichedOption<T, N>
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.