pub struct SlotFile<P: ValueWidthPolicy> { /* private fields */ }Expand description
Bounded indexed storage whose occupancy is measured in policy-defined units.
A value is loaded only through the first slot in its span. Replacing any unit of an initialized span first releases the entire old value, so partial overwrites are always observable as explicit uninitialization.
Implementations§
Source§impl<P: ValueWidthPolicy> SlotFile<P>
impl<P: ValueWidthPolicy> SlotFile<P>
Sourcepub fn new(limit: AdmissionLimit) -> Self
pub fn new(limit: AdmissionLimit) -> Self
Creates an uninitialized slot file using the control organ’s admission limit.
Sourcepub fn load(&self, slot: usize) -> Result<&P::Value, SlotError>
pub fn load(&self, slot: usize) -> Result<&P::Value, SlotError>
Returns the initialized value beginning at slot.
Sourcepub fn store(&mut self, slot: usize, value: P::Value) -> Result<(), SlotError>
pub fn store(&mut self, slot: usize, value: P::Value) -> Result<(), SlotError>
Stores value beginning at slot, releasing every overlapped span.
Sourcepub fn release(&mut self, slot: usize) -> Result<P::Value, SlotError>
pub fn release(&mut self, slot: usize) -> Result<P::Value, SlotError>
Releases the initialized span containing slot and clears all its units.
Sourcepub fn is_initialized(&self, slot: usize) -> bool
pub fn is_initialized(&self, slot: usize) -> bool
Returns whether slot is occupied by any initialized span.
Sourcepub fn visit_values(&self, visit: impl FnMut(&P::Value))
pub fn visit_values(&self, visit: impl FnMut(&P::Value))
Visits initialized values in ascending start-slot order.
Auto Trait Implementations§
impl<P> Freeze for SlotFile<P>
impl<P> RefUnwindSafe for SlotFile<P>
impl<P> Send for SlotFile<P>
impl<P> Sync for SlotFile<P>
impl<P> Unpin for SlotFile<P>
impl<P> UnsafeUnpin for SlotFile<P>
impl<P> UnwindSafe for SlotFile<P>
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