#[repr(C, packed(1))]pub struct PodCOption<T>{
pub option: [u8; 4],
pub value: T,
}Expand description
COption<T> stored as a Pod type
Fields§
§option: [u8; 4]Whether a value is set
value: TThe value
Implementations§
Source§impl<T> PodCOption<T>
impl<T> PodCOption<T>
Sourcepub const SOME: [u8; 4]
pub const SOME: [u8; 4]
Represents that some value is stored in the option, like
Option::Some(v)
Sourcepub fn none() -> Self
pub fn none() -> Self
Create a PodCOption equivalent of Option::None
This could be made const by using core::mem::zeroed, but that would
require unsafe code, which is prohibited at the crate level.
Trait Implementations§
Source§impl<T> Clone for PodCOption<T>
impl<T> Clone for PodCOption<T>
Source§fn clone(&self) -> PodCOption<T>
fn clone(&self) -> PodCOption<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for PodCOption<T>
impl<T> Debug for PodCOption<T>
Source§impl<T> Default for PodCOption<T>
impl<T> Default for PodCOption<T>
Source§fn default() -> PodCOption<T>
fn default() -> PodCOption<T>
Returns the “default value” for a type. Read more
Source§impl<T> PartialEq for PodCOption<T>
impl<T> PartialEq for PodCOption<T>
Source§fn eq(&self, other: &PodCOption<T>) -> bool
fn eq(&self, other: &PodCOption<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T> Zeroable for PodCOption<T>
impl<T> Zeroable for PodCOption<T>
impl<T> Copy for PodCOption<T>
impl<T> Pod for PodCOption<T>
impl<T> StructuralPartialEq for PodCOption<T>
Auto Trait Implementations§
impl<T> Freeze for PodCOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for PodCOption<T>where
T: RefUnwindSafe,
impl<T> Send for PodCOption<T>where
T: Send,
impl<T> Sync for PodCOption<T>where
T: Sync,
impl<T> Unpin for PodCOption<T>where
T: Unpin,
impl<T> UnsafeUnpin for PodCOption<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for PodCOption<T>where
T: UnwindSafe,
Blanket Implementations§
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.