#[repr(C)]pub struct PrimitiveOption<T: Copy> {
pub has_value: u8,
pub _pad: [u8; 7],
pub value: T,
}Expand description
Option for primitive (non-pointer) types.
§Memory layout (16 bytes for T=f64/i64, 8 bytes could suffice for smaller T)
Offset Size Field
------ ---- -----
0 1 has_value (0 = None, 1 = Some)
1 7 _pad (align to 8)
8 sz(T) valueFields§
§has_value: u80 = None, 1 = Some.
_pad: [u8; 7]Padding to align value to 8 bytes.
value: TThe value (only valid when has_value == 1).
Implementations§
Auto Trait Implementations§
impl<T> Freeze for PrimitiveOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for PrimitiveOption<T>where
T: RefUnwindSafe,
impl<T> Send for PrimitiveOption<T>where
T: Send,
impl<T> Sync for PrimitiveOption<T>where
T: Sync,
impl<T> Unpin for PrimitiveOption<T>where
T: Unpin,
impl<T> UnsafeUnpin for PrimitiveOption<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for PrimitiveOption<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