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.
Sourcepub fn die(&self) -> Result<(), HandlerError>
pub fn die(&self) -> Result<(), HandlerError>
Removes the SHM file from the system.
Should be called before the application exits to prevent the SHM file
from persisting in /dev/shm/ across runs. This is an explicit, opt-
in cleanup - if omitted, the file survives until the system reboots
or it’s manually removed.
Existing mapping remains valid until the handlers are dropped; this only removes the filesystem entry, preventing new attachments.
Trait Implementations§
Source§impl HandlerFunctions for MatrixHandler
impl HandlerFunctions for MatrixHandler
Source§fn matrix(&self) -> &AtomicMatrix
fn matrix(&self) -> &AtomicMatrix
AtomicMatrix.Source§fn first_block_offset(&self) -> u32
fn first_block_offset(&self) -> u32
internals iterators as the physical chain walk start point.Source§fn segment_size(&self) -> u32
fn segment_size(&self) -> u32
Source§fn allocate<T>(&self) -> Result<Block<T>, HandlerError>
fn allocate<T>(&self) -> Result<Block<T>, HandlerError>
T. Read moreSource§fn allocate_raw(&self, size: u32) -> Result<RelativePtr<u8>, HandlerError>
fn allocate_raw(&self, size: u32) -> Result<RelativePtr<u8>, HandlerError>
Source§unsafe fn write<T>(&self, block: &mut Block<T>, value: T)
unsafe fn write<T>(&self, block: &mut Block<T>, value: T)
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
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
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>
Source§fn get_state<T>(&self, block: &Block<T>, order: Ordering) -> u32
fn get_state<T>(&self, block: &Block<T>, order: Ordering) -> u32
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>
Source§fn raw_matrix(&self) -> &AtomicMatrix
fn raw_matrix(&self) -> &AtomicMatrix
AtomicMatrix. Read more