#[repr(u8)]pub enum ArchivedOption<T> {
None,
Some(T),
}
Expand description
Variants§
Implementations§
Source§impl<T> ArchivedOption<T>
impl<T> ArchivedOption<T>
Sourcepub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>>
pub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>>
Converts from Pin<&ArchivedOption<T>>
to Option<Pin<&T>>
.
Sourcepub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>>
pub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>>
Converts from Pin<&mut ArchivedOption<T>>
to Option<Pin<&mut T>>
.
Sourcepub const fn iter(&self) -> Iter<'_, T> ⓘ
pub const fn iter(&self) -> Iter<'_, T> ⓘ
Returns an iterator over the possibly contained value.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Returns a mutable iterator over the possibly contained value.
Sourcepub fn get_or_insert(&mut self, v: T) -> &mut T
pub fn get_or_insert(&mut self, v: T) -> &mut T
Inserts v
into the option if it is None
, then returns a mutable
reference to the contained value.
Sourcepub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T
pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T
Inserts a value computed from f
into the option if it is None
, then
returns a mutable reference to the contained value.
Source§impl<T: Deref> ArchivedOption<T>
impl<T: Deref> ArchivedOption<T>
Source§impl<T: DerefMut> ArchivedOption<T>
impl<T: DerefMut> ArchivedOption<T>
Sourcepub fn as_deref_mut(&mut self) -> Option<&mut <T as Deref>::Target>
pub fn as_deref_mut(&mut self) -> Option<&mut <T as Deref>::Target>
Converts from &mut ArchivedOption<T>
to Option<&mut T::Target>
.
Leaves the original ArchivedOption
in-place, creating a new Option
with a mutable
reference to the inner type’s Deref::Target
type.
Trait Implementations§
Source§impl<__C: ?Sized, T> CheckBytes<__C> for ArchivedOption<T>where
T: CheckBytes<__C>,
impl<__C: ?Sized, T> CheckBytes<__C> for ArchivedOption<T>where
T: CheckBytes<__C>,
Source§type Error = EnumCheckError<u8>
type Error = EnumCheckError<u8>
The error that may result from checking the type.
Source§unsafe fn check_bytes<'__bytecheck>(
value: *const Self,
context: &mut __C,
) -> Result<&'__bytecheck Self, EnumCheckError<u8>>
unsafe fn check_bytes<'__bytecheck>( value: *const Self, context: &mut __C, ) -> Result<&'__bytecheck Self, EnumCheckError<u8>>
Checks whether the given pointer points to a valid value within the
given context. Read more
Source§impl<T: Debug> Debug for ArchivedOption<T>
impl<T: Debug> Debug for ArchivedOption<T>
Source§impl<T: Archive, D: Fallible + ?Sized> Deserialize<Option<T>, D> for ArchivedOption<T::Archived>where
T::Archived: Deserialize<T, D>,
impl<T: Archive, D: Fallible + ?Sized> Deserialize<Option<T>, D> for ArchivedOption<T::Archived>where
T::Archived: Deserialize<T, D>,
Source§impl<A, O, D> DeserializeWith<ArchivedOption<<A as ArchiveWith<O>>::Archived>, Option<O>, D> for Map<A>
impl<A, O, D> DeserializeWith<ArchivedOption<<A as ArchiveWith<O>>::Archived>, Option<O>, D> for Map<A>
Source§fn deserialize_with(
field: &ArchivedOption<<A as ArchiveWith<O>>::Archived>,
d: &mut D,
) -> Result<Option<O>, D::Error>
fn deserialize_with( field: &ArchivedOption<<A as ArchiveWith<O>>::Archived>, d: &mut D, ) -> Result<Option<O>, D::Error>
Deserializes the field type
F
using the given deserializer.Source§impl<T: Hash> Hash for ArchivedOption<T>
impl<T: Hash> Hash for ArchivedOption<T>
Source§impl<T: Ord> Ord for ArchivedOption<T>
impl<T: Ord> Ord for ArchivedOption<T>
Source§impl<T: PartialEq> PartialEq for ArchivedOption<T>
impl<T: PartialEq> PartialEq for ArchivedOption<T>
Source§impl<T: PartialOrd> PartialOrd for ArchivedOption<T>
impl<T: PartialOrd> PartialOrd for ArchivedOption<T>
impl<T: Eq> Eq for ArchivedOption<T>
Auto Trait Implementations§
impl<T> Freeze for ArchivedOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for ArchivedOption<T>where
T: RefUnwindSafe,
impl<T> Send for ArchivedOption<T>where
T: Send,
impl<T> Sync for ArchivedOption<T>where
T: Sync,
impl<T> Unpin for ArchivedOption<T>where
T: Unpin,
impl<T> UnwindSafe for ArchivedOption<T>where
T: UnwindSafe,
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<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: *const T) -> Layout
fn layout_raw(_: *const T) -> Layout
Gets the layout of the type.