pub struct FlatSlot<'a, T: FlatStruct> { /* private fields */ }Expand description
Loaned slot. The caller sets the sample via write() and then
calls commit(). Dropping without a commit discards the loan.
Implementations§
Source§impl<T: FlatStruct> FlatSlot<'_, T>
impl<T: FlatStruct> FlatSlot<'_, T>
Sourcepub fn as_mut(&mut self) -> Result<&mut T, SlotError>
pub fn as_mut(&mut self) -> Result<&mut T, SlotError>
True zero-copy (Spec §8.2): a &mut T view directly onto the SHM
slot. The slot’s WIRE_SIZE bytes are zeroed first (so the all-zero
bit pattern is a valid T — bool fields are false, etc.); the
caller fills the fields in place, then calls Self::commit_in_place.
No staging buffer and no copy on commit.
§Errors
NoFreeSlot/OutOfBounds/SampleTooLarge from the backend.
Sourcepub fn commit_in_place(self) -> Result<u32, SlotError>
pub fn commit_in_place(self) -> Result<u32, SlotError>
Commits a slot whose T was written in place via Self::as_mut —
no copy (counterpart to Self::commit). Returns the SN.
§Errors
As for commit_in_place.
Trait Implementations§
Source§impl<T: FlatStruct> Drop for FlatSlot<'_, T>
impl<T: FlatStruct> Drop for FlatSlot<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for FlatSlot<'a, T>
impl<'a, T> RefUnwindSafe for FlatSlot<'a, T>
impl<'a, T> Send for FlatSlot<'a, T>
impl<'a, T> Sync for FlatSlot<'a, T>
impl<'a, T> Unpin for FlatSlot<'a, T>
impl<'a, T> UnsafeUnpin for FlatSlot<'a, T>
impl<'a, T> UnwindSafe for FlatSlot<'a, 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