pub struct FlatWriter<T: FlatStruct> { /* private fields */ }Expand description
Writes FlatStruct samples directly into SHM slots — without CDR encoding.
Implementations§
Source§impl<T: FlatStruct> FlatWriter<T>
impl<T: FlatStruct> FlatWriter<T>
Sourcepub fn new(
alloc: Arc<InMemorySlotAllocator>,
active_readers_mask: ReaderMask,
) -> Self
pub fn new( alloc: Arc<InMemorySlotAllocator>, active_readers_mask: ReaderMask, ) -> Self
Creates a writer over an allocator. active_readers_mask
lists the reader bits that must all have read before
a slot can be reused.
Sourcepub fn write(&self, sample: &T) -> Result<u32, SlotError>
pub fn write(&self, sample: &T) -> Result<u32, SlotError>
Spec §8.1 write_flat — reserve + memcpy + commit in a single call.
§Errors
SlotError::NoFreeSlot under resource pressure;
SampleTooLarge when the slot is smaller than T::WIRE_SIZE.
Sourcepub fn write_bp(
&self,
sample: &T,
reliability: Reliability,
timeout: Duration,
) -> Result<WriteOutcome, SlotError>
pub fn write_bp( &self, sample: &T, reliability: Reliability, timeout: Duration, ) -> Result<WriteOutcome, SlotError>
Spec §10.5 backpressure-aware write. On NoFreeSlot: BestEffort
drops the sample (WriteOutcome::Dropped); Reliable blocks
event-driven on the allocator’s notify until a slot frees or timeout
elapses (WriteOutcome::TimedOut) — no busy-poll.
§Errors
Non-NoFreeSlot slot errors (e.g. SampleTooLarge, lock poison).
Auto Trait Implementations§
impl<T> Freeze for FlatWriter<T>
impl<T> RefUnwindSafe for FlatWriter<T>
impl<T> Send for FlatWriter<T>
impl<T> Sync for FlatWriter<T>
impl<T> Unpin for FlatWriter<T>
impl<T> UnsafeUnpin for FlatWriter<T>
impl<T> UnwindSafe for FlatWriter<T>
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