pub struct SlotTracker<T: SlotStateTypes> { /* private fields */ }

Implementations§

source§

impl<T: SlotStateTypes> SlotTracker<T>

source

pub fn new(iter: impl Iterator<Item = (T::Common, T::Free)>) -> Self

source

pub fn new_with_capacity( common: T::Common, free: T::Free, capacity: usize, ) -> Self
where T: SlotStateTypes<Common: Clone, Free: Clone>,

source

pub fn new_occupied( iter: impl Iterator<Item = (T::Common, T::Occupied)>, ) -> Self

source

pub fn new_occupied_with_capacity( common: T::Common, occupied: T::Occupied, capacity: usize, ) -> Self
where T: SlotStateTypes<Common: Clone, Occupied: Clone>,

source

pub fn capacity(&self) -> usize

source

pub fn num_free(&self) -> usize

source

pub fn num_occupied(&self) -> usize

source

pub fn peek_next_free_index(&self) -> Option<usize>

source

pub fn peek_next_free_value(&self) -> Option<&T::Free>

source

pub fn get_common_value( &self, index: usize, ) -> Result<&T::Common, SlotTrackerError>

source

pub fn get_common_value_mut( &mut self, index: usize, ) -> Result<&mut T::Common, SlotTrackerError>

source

pub fn get_state(&self, index: usize) -> Result<SlotState, SlotTrackerError>

source

pub fn get_state_value( &self, index: usize, ) -> Result<SlotStateValueRef<'_, T>, SlotTrackerError>

source

pub fn get_state_value_mut( &mut self, index: usize, ) -> Result<SlotStateValueRefMut<'_, T>, SlotTrackerError>

source

pub fn occupy(&mut self, value: T::Occupied) -> Option<(usize, T::Free)>

source

pub fn free( &mut self, index: usize, value: T::Free, ) -> Result<T::Occupied, SlotTrackerError>

Auto Trait Implementations§

§

impl<T> Freeze for SlotTracker<T>

§

impl<T> RefUnwindSafe for SlotTracker<T>
where <T as SlotStateTypes>::Common: RefUnwindSafe, <T as SlotStateTypes>::Free: RefUnwindSafe, <T as SlotStateTypes>::Occupied: RefUnwindSafe,

§

impl<T> Send for SlotTracker<T>
where <T as SlotStateTypes>::Common: Send, <T as SlotStateTypes>::Free: Send, <T as SlotStateTypes>::Occupied: Send,

§

impl<T> Sync for SlotTracker<T>
where <T as SlotStateTypes>::Common: Sync, <T as SlotStateTypes>::Free: Sync, <T as SlotStateTypes>::Occupied: Sync,

§

impl<T> Unpin for SlotTracker<T>
where <T as SlotStateTypes>::Common: Unpin, <T as SlotStateTypes>::Free: Unpin, <T as SlotStateTypes>::Occupied: Unpin,

§

impl<T> UnwindSafe for SlotTracker<T>
where <T as SlotStateTypes>::Common: UnwindSafe, <T as SlotStateTypes>::Free: UnwindSafe, <T as SlotStateTypes>::Occupied: UnwindSafe,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.