Struct stack_graphs::arena::Arena[][src]

pub struct Arena<T> { /* fields omitted */ }
Expand description

Manages the life cycle of instances of type T. You can allocate new instances of T from the arena. All of the instances managed by this arena will be dropped as a single operation when the arena itself is dropped.

Implementations

impl<T> Arena<T>[src]

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

Creates a new arena.

pub fn add(&mut self, item: T) -> Handle<T>[src]

Adds a new instance to this arena, returning a stable handle to it.

Note that we do not deduplicate instances of T in any way. If you add two instances that have the same content, you will get distinct handles for each one.

pub fn get(&self, handle: Handle<T>) -> &T[src]

Dereferences a handle to an instance owned by this arena, returning a reference to it.

pub fn get_mut(&mut self, handle: Handle<T>) -> &mut T[src]

Dereferences a handle to an instance owned by this arena, returning a mutable reference to it.

pub fn iter_handles(&self) -> impl Iterator<Item = Handle<T>>[src]

Returns an iterator of all of the handles in this arena. (Note that this iterator does not retain a reference to the arena!)

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

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

Immutably borrows from an owned value. Read more

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

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

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.