[][src]Struct salva2d::object::ContiguousArena

pub struct ContiguousArena<Idx, T> { /* fields omitted */ }

This is a Vec behind a generational arena.

The goal of this structure is to have unique identifiers for elements stored contiguously on a Vec.


impl<Idx, T> ContiguousArena<Idx, T>[src]

pub fn new() -> Self[src]

Creates a new empty arena.

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

The number of objects on this arena.

pub fn get(&self, handle: Idx) -> Option<&T> where
    Idx: Into<ContiguousArenaIndex>, 

Gets a reference to the object identified by handle.

pub fn get_mut(&mut self, handle: Idx) -> Option<&mut T> where
    Idx: Into<ContiguousArenaIndex>, 

Gets a mutable reference to the object identified by handle.

pub fn values(&self) -> Iter<T>[src]

Gets references to all the objects on this set.

pub fn values_mut(&mut self) -> IterMut<T>[src]

Gets mutable references to all the objects on this set.

pub fn iter<'a>(&'a self) -> impl Iterator<Item = (Idx, &'a T)> + 'a where
    Idx: From<ContiguousArenaIndex>, 

Iter through all the objects as well as their handle.

pub fn as_slice(&self) -> &[T][src]

Retrieves the set of objects as a slice.

pub fn as_mut_slice(&mut self) -> &mut [T][src]

Retrieves the set of objects as a mutable slice.

pub fn insert(&mut self, object: T) -> Idx where
    Idx: From<ContiguousArenaIndex>, 

Insert an object into this set.

pub fn remove(&mut self, handle: Idx) -> Option<T> where
    Idx: Into<ContiguousArenaIndex>, 

Remove an object from this set.

Trait Implementations

impl<Idx, T> AsMut<[T]> for ContiguousArena<Idx, T>[src]

impl<Idx, T> AsRef<[T]> for ContiguousArena<Idx, T>[src]

impl<Idx: Clone, T: Clone> Clone for ContiguousArena<Idx, T>[src]

impl<Idx: Into<ContiguousArenaIndex>, T> Index<Idx> for ContiguousArena<Idx, T>[src]

type Output = T

The returned type after indexing.

impl<Idx: Into<ContiguousArenaIndex>, T> IndexMut<Idx> for ContiguousArena<Idx, T>[src]

Auto Trait Implementations

impl<Idx, T> RefUnwindSafe for ContiguousArena<Idx, T> where
    Idx: RefUnwindSafe,
    T: RefUnwindSafe

impl<Idx, T> Send for ContiguousArena<Idx, T> where
    Idx: Send,
    T: Send

impl<Idx, T> Sync for ContiguousArena<Idx, T> where
    Idx: Sync,
    T: Sync

impl<Idx, T> Unpin for ContiguousArena<Idx, T> where
    Idx: Unpin,
    T: Unpin

impl<Idx, T> UnwindSafe for ContiguousArena<Idx, T> where
    Idx: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,