Struct simple_slab::Slab [] [src]

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

Methods

impl<T> Slab<T>
[src]

fn new() -> Slab<T>

Creates a new Slab

fn with_capacity(capacity: usize) -> Slab<T>

Creates a new, empty Slab with room for capacity elems

Panics

Panics if the host system is out of memory

fn insert(&mut self, elem: T)

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

Panics

  • If the host system is out of memory.

fn remove(&mut self, offset: usize) -> T

Removes the element at offset.

Panics

  • If offset is out of bounds.

fn len(&self) -> usize

Returns the number of elements in the slab

fn iter(&self) -> SlabIter<T>

Returns an iterator over the slab

fn iter_mut(&mut self) -> SlabMutIter<T>

Returns a mutable iterator over the slab

Trait Implementations

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

fn drop(&mut self)

A method called when the value goes out of scope. Read more

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

type Output = T

The returned type after indexing

fn index(&self, index: usize) -> &Self::Output

The method for the indexing (Foo[Bar]) operation

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?

fn into_iter(self) -> SlabIter<'a, T>

Creates an iterator from a value. Read more

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?

fn into_iter(self) -> SlabMutIter<'a, T>

Creates an iterator from a value. Read more