pub struct FlatSampleRef<T: FlatStruct> { /* private fields */ }Expand description
Reference sample that holds its source slot for the duration of its
lifetime and sets this reader’s bit on Drop (releasing the slot for
recycling). Spec §9.2/§9.3. Returned by FlatReader::read_ref.
While a FlatSampleRef is alive the writer cannot reuse its slot — that is
the zero-copy lifetime guarantee. Dropping it (or calling
Self::into_inner) releases the slot.
Implementations§
Source§impl<T: FlatStruct> FlatSampleRef<T>
impl<T: FlatStruct> FlatSampleRef<T>
Sourcepub fn new(sample: T) -> Self
pub fn new(sample: T) -> Self
Wraps a read sample without a deferred release (plain owned copy).
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the wrapper and returns the (copied) sample. The slot is
released here (the wrapper’s Drop runs as it goes out of scope).
Trait Implementations§
Source§impl<T: FlatStruct> Deref for FlatSampleRef<T>
impl<T: FlatStruct> Deref for FlatSampleRef<T>
Source§impl<T: FlatStruct> Drop for FlatSampleRef<T>
impl<T: FlatStruct> Drop for FlatSampleRef<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for FlatSampleRef<T>
impl<T> !UnwindSafe for FlatSampleRef<T>
impl<T> Freeze for FlatSampleRef<T>where
T: Freeze,
impl<T> Send for FlatSampleRef<T>
impl<T> Sync for FlatSampleRef<T>
impl<T> Unpin for FlatSampleRef<T>where
T: Unpin,
impl<T> UnsafeUnpin for FlatSampleRef<T>where
T: UnsafeUnpin,
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