pub struct MatrixHandler { /* private fields */ }Expand description
The primary interface for interacting with an AtomicMatrix.
Owns the SHM mapping. Cannot be cloned — use [share()] to produce a
SharedHandler for other threads.
See module documentation for the full abstraction layer diagram.
Implementations§
Source§impl MatrixHandler
impl MatrixHandler
Produces a lightweight SharedHandler that can be sent to other threads.
SharedHandler holds raw pointers into the SHM segment. This handler
must outlive all shared handles derived from it — Rust cannot enforce
this lifetime relationship automatically because SharedHandler uses raw
pointers. Violating this contract is undefined behaviour.
Trait Implementations§
Source§impl HandlerFunctions for MatrixHandler
impl HandlerFunctions for MatrixHandler
Source§fn matrix(&self) -> &AtomicMatrix
fn matrix(&self) -> &AtomicMatrix
Returns a reference to the underlying
AtomicMatrix.Source§fn first_block_offset(&self) -> u32
fn first_block_offset(&self) -> u32
Returns the offset of the first data block in the segment.
Used by
internals iterators as the physical chain walk start point.Source§fn segment_size(&self) -> u32
fn segment_size(&self) -> u32
Returns the total segment size in bytes.
Source§fn allocate<T>(&self) -> Result<Block<T>, HandlerError>
fn allocate<T>(&self) -> Result<Block<T>, HandlerError>
Allocates a block sized to hold
T. Read moreSource§fn allocate_raw(&self, size: u32) -> Result<RelativePtr<u8>, HandlerError>
fn allocate_raw(&self, size: u32) -> Result<RelativePtr<u8>, HandlerError>
Allocates a raw byte block of the given size. Read more
Source§unsafe fn write<T>(&self, block: &mut Block<T>, value: T)
unsafe fn write<T>(&self, block: &mut Block<T>, value: T)
Writes a value of type
T into an allocated block. Read moreSource§unsafe fn read<'a, T>(&self, block: &Block<T>) -> &'a T
unsafe fn read<'a, T>(&self, block: &Block<T>) -> &'a T
Reads a shared reference to
T from an allocated block. Read moreSource§unsafe fn read_mut<'a, T>(&self, block: &Block<T>) -> &'a mut T
unsafe fn read_mut<'a, T>(&self, block: &Block<T>) -> &'a mut T
Reads a mutable reference to
T from an allocated block. Read moreSource§fn set_state<T>(&self, block: &Block<T>, state: u32) -> Result<(), HandlerError>
fn set_state<T>(&self, block: &Block<T>, state: u32) -> Result<(), HandlerError>
Sets a user-defined lifecycle state on a block. Read more
Source§fn get_state<T>(&self, block: &Block<T>, order: Ordering) -> u32
fn get_state<T>(&self, block: &Block<T>, order: Ordering) -> u32
Returns the current state of a block. Read more
Source§fn transition_state<T>(
&self,
block: &Block<T>,
expected: u32,
next: u32,
success_order: Ordering,
) -> Result<u32, HandlerError>
fn transition_state<T>( &self, block: &Block<T>, expected: u32, next: u32, success_order: Ordering, ) -> Result<u32, HandlerError>
Atomically transitions a block from one state to another. Read more
Source§fn raw_matrix(&self) -> &AtomicMatrix
fn raw_matrix(&self) -> &AtomicMatrix
Returns a raw reference to the underlying
AtomicMatrix. Read moreAuto Trait Implementations§
impl Freeze for MatrixHandler
impl RefUnwindSafe for MatrixHandler
impl Send for MatrixHandler
impl Sync for MatrixHandler
impl Unpin for MatrixHandler
impl UnsafeUnpin for MatrixHandler
impl !UnwindSafe for MatrixHandler
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