Struct rafx_base::slab::RawSlab[][src]

pub struct RawSlab<T> { /* fields omitted */ }

A very simple, minimalist slab structure. Consider using one of the other slabs instead as they are less error prone for many use-cases.

Implementations

impl<T> RawSlab<T>[src]

pub fn new() -> Self[src]

Create an empty RawSlab

pub fn with_capacity(capacity: SlabIndexT) -> Self[src]

Create an empty but presized RawSlab

pub fn allocate(&mut self, value: T) -> RawSlabKey<T>[src]

Allocate a slot within the raw slab.

Allocation can cause vectors to be resized. Use with_capacity to avoid this.

pub fn allocate_with_key<F: FnMut(RawSlabKey<T>) -> T>(
    &mut self,
    f: F
) -> RawSlabKey<T>
[src]

pub fn free(&mut self, slab_key: RawSlabKey<T>)[src]

Free an element in the raw slab. It is fatal to free an element that doesn’t exist.

pub fn exists(&self, slab_key: RawSlabKey<T>) -> bool[src]

Check if an element exists

pub fn get(&self, slab_key: RawSlabKey<T>) -> Option<&T>[src]

Try to get the given element

pub fn get_mut(&mut self, slab_key: RawSlabKey<T>) -> Option<&mut T>[src]

Try to get the given element

pub fn iter(&self) -> impl Iterator<Item = (RawSlabKey<T>, &T)>[src]

Iterate all values

pub fn iter_mut(&mut self) -> impl Iterator<Item = (RawSlabKey<T>, &mut T)>[src]

Iterate all values

pub fn allocated_count(&self) -> usize[src]

Return count of allocated Ts

pub fn storage_size(&self) -> usize[src]

Trait Implementations

impl<T> Default for RawSlab<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for RawSlab<T> where
    T: RefUnwindSafe

impl<T> Send for RawSlab<T> where
    T: Send

impl<T> Sync for RawSlab<T> where
    T: Sync

impl<T> Unpin for RawSlab<T> where
    T: Unpin

impl<T> UnwindSafe for RawSlab<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: Downcast + Send + Sync
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.