[][src]Struct compact_arena::TinyArena

pub struct TinyArena<'tag, T> { /* fields omitted */ }

A "tiny" arena containing up to 65536 elements. This variant only works with types implementing Default.

You will likely use this via the in_tiny_arena function.

Methods

impl<'tag, T: Copy + Clone + Default> TinyArena<'tag, T>[src]

pub unsafe fn new(tag: InvariantLifetime<'tag>) -> TinyArena<'tag, T>[src]

create a new TinyArena. Don't do this manually. Use the in_tiny_arena macro instead.

Safety

The whole tagged indexing trick relies on the 'tag you give to this constructor. You must never use this value in another arena, lest you might be able to mix up the indices of the two, which could lead to out of bounds access and thus Undefined Behavior!

pub fn try_add(&mut self, item: T) -> Result<Idx16<'tag>, CapacityExceeded<T>>[src]

Add an item to the arena, get an index or CapacityExceeded back.

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

Add an item to the arena, get an index back

Trait Implementations

impl<'tag, T> Index<Idx<'tag, u16>> for TinyArena<'tag, T>[src]

type Output = T

The returned type after indexing.

impl<'tag, T> IndexMut<Idx<'tag, u16>> for TinyArena<'tag, T>[src]

Auto Trait Implementations

impl<'tag, T> Send for TinyArena<'tag, T> where
    T: Send

impl<'tag, T> Sync for TinyArena<'tag, T> where
    T: Sync

Blanket Implementations

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.

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

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

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