[][src]Struct salva3d::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.

Implementations

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

pub fn new() -> Self[src]

Creates a new empty arena.

pub fn get_from_contiguous_index(&self, index: usize) -> Option<(&T, Idx)> where
    Idx: From<ContiguousArenaIndex>, 
[src]

Get an element from its position on the contiguous array.

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>, 
[src]

Gets a reference to the object identified by handle.

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

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>, 
[src]

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>, 
[src]

Insert an object into this set.

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

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
[src]

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

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

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

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

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> 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
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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