Skip to main content

SlotFile

Struct SlotFile 

Source
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>

Source

pub fn new(limit: AdmissionLimit) -> Self

Creates an uninitialized slot file using the control organ’s admission limit.

Source

pub fn limit(&self) -> usize

Returns the number of logical slots in the file.

Source

pub fn load(&self, slot: usize) -> Result<&P::Value, SlotError>

Returns the initialized value beginning at slot.

Source

pub fn store(&mut self, slot: usize, value: P::Value) -> Result<(), SlotError>

Stores value beginning at slot, releasing every overlapped span.

Source

pub fn release(&mut self, slot: usize) -> Result<P::Value, SlotError>

Releases the initialized span containing slot and clears all its units.

Source

pub fn is_initialized(&self, slot: usize) -> bool

Returns whether slot is occupied by any initialized span.

Source

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>
where P: Send, <P as ValueWidthPolicy>::Value: Send,

§

impl<P> Sync for SlotFile<P>
where P: Sync, <P as ValueWidthPolicy>::Value: Sync,

§

impl<P> Unpin for SlotFile<P>
where P: Unpin, <P as ValueWidthPolicy>::Value: Unpin,

§

impl<P> UnsafeUnpin for SlotFile<P>

§

impl<P> UnwindSafe for SlotFile<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.