[][src]Struct simple_slab::Slab

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

Implementations

impl<T> Slab<T>[src]

pub fn new() -> Slab<T>[src]

Creates a new Slab

pub fn with_capacity(capacity: usize) -> Slab<T>[src]

Creates a new, empty Slab with room for capacity elems

Panics

  • If the host system is out of memory

pub fn insert(&mut self, elem: T)[src]

Inserts a new element into the slab, re-allocating if neccessary.

Panics

  • If the host system is out of memory.

pub fn remove(&mut self, offset: usize) -> T[src]

Removes the element at offset.

Panics

  • If offset is out of bounds.

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

Returns the number of elements in the slab

pub fn iter(&self) -> SlabIter<'_, T>

Notable traits for SlabIter<'a, T>

impl<'a, T> Iterator for SlabIter<'a, T> type Item = &'a T;
[src]

Returns an iterator over the slab

pub fn iter_mut(&mut self) -> SlabMutIter<'_, T>

Notable traits for SlabMutIter<'a, T>

impl<'a, T> Iterator for SlabMutIter<'a, T> type Item = &'a mut T;
[src]

Returns a mutable iterator over the slab

Trait Implementations

impl<T> Drop for Slab<T>[src]

impl<T> Index<usize> for Slab<T>[src]

type Output = T

The returned type after indexing.

impl<'a, T> IntoIterator for &'a Slab<T>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = SlabIter<'a, T>

Which kind of iterator are we turning this into?

impl<'a, T> IntoIterator for &'a mut Slab<T>[src]

type Item = &'a mut T

The type of the elements being iterated over.

type IntoIter = SlabMutIter<'a, T>

Which kind of iterator are we turning this into?

Auto Trait Implementations

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

impl<T> !Send for Slab<T>

impl<T> !Sync for Slab<T>

impl<T> Unpin for Slab<T>

impl<T> UnwindSafe for Slab<T> where
    T: RefUnwindSafe

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> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.