pub struct ControlBlockStateHelper;Expand description
Helper for reading/writing state to/from ControlBlock.
Implementations§
Source§impl ControlBlockStateHelper
impl ControlBlockStateHelper
Sourcepub fn write_embedded<S: EmbeddedState>(
block: &mut ControlBlock,
state: &S,
) -> Result<()>
pub fn write_embedded<S: EmbeddedState>( block: &mut ControlBlock, state: &S, ) -> Result<()>
Write embedded state to ControlBlock’s reserved field.
§Errors
Returns error if state doesn’t fit in 24 bytes.
Sourcepub fn read_embedded<S: EmbeddedState>(block: &ControlBlock) -> Result<S>
pub fn read_embedded<S: EmbeddedState>(block: &ControlBlock) -> Result<S>
Read embedded state from ControlBlock’s reserved field.
§Errors
Returns error if state type size exceeds 24 bytes.
Sourcepub fn write_descriptor(
block: &mut ControlBlock,
descriptor: &StateDescriptor,
) -> Result<()>
pub fn write_descriptor( block: &mut ControlBlock, descriptor: &StateDescriptor, ) -> Result<()>
Write state descriptor for external state.
Sourcepub fn read_descriptor(block: &ControlBlock) -> Option<StateDescriptor>
pub fn read_descriptor(block: &ControlBlock) -> Option<StateDescriptor>
Read state descriptor from ControlBlock.
Returns None if no valid descriptor is present.
Sourcepub fn has_embedded_state(block: &ControlBlock) -> bool
pub fn has_embedded_state(block: &ControlBlock) -> bool
Check if ControlBlock has embedded state (no external pointer).
Sourcepub fn has_external_state(block: &ControlBlock) -> bool
pub fn has_external_state(block: &ControlBlock) -> bool
Check if ControlBlock references external state.
Sourcepub fn clear_state(block: &mut ControlBlock)
pub fn clear_state(block: &mut ControlBlock)
Clear all state from ControlBlock.
Sourcepub fn raw_bytes(block: &ControlBlock) -> &[u8; 24]
pub fn raw_bytes(block: &ControlBlock) -> &[u8; 24]
Get raw bytes from reserved field.
Sourcepub fn raw_bytes_mut(block: &mut ControlBlock) -> &mut [u8; 24]
pub fn raw_bytes_mut(block: &mut ControlBlock) -> &mut [u8; 24]
Get mutable raw bytes from reserved field.
Auto Trait Implementations§
impl Freeze for ControlBlockStateHelper
impl RefUnwindSafe for ControlBlockStateHelper
impl Send for ControlBlockStateHelper
impl Sync for ControlBlockStateHelper
impl Unpin for ControlBlockStateHelper
impl UnwindSafe for ControlBlockStateHelper
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<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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Gets the layout of the type.