[][src]Struct compact_arena::SmallArena

pub struct SmallArena<T, B> { /* fields omitted */ }

A "Small" arena based on a resizable slice (i.e. a Vec) that can be indexed with 32-bit Idx32s. This can help reduce memory overhead when using many pointer-heavy objects on 64-bit systems.

You will usually use this type by calling in_arena or similar functions.

Methods

impl<T, B> SmallArena<T, B>[src]

pub unsafe fn new(_: B, capacity: usize) -> SmallArena<T, B>[src]

create a new SmallArena. Don't do this manually. Use the in_arena macro instead.

Safety

The whole tagged indexing trick relies on the B type you give to this constructor. You must never use this type 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 add(&mut self, item: T) -> Idx32<B>[src]

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

Trait Implementations

impl<B, T> Index<Idx<u32, B>> for SmallArena<T, B>[src]

type Output = T

The returned type after indexing.

fn index(&self, i: Idx32<B>) -> &T[src]

Gets an immutable reference to the value at this index.

impl<B, T> IndexMut<Idx<u32, B>> for SmallArena<T, B>[src]

fn index_mut(&mut self, i: Idx32<B>) -> &mut T[src]

Gets a mutable reference to the value at this index.

Auto Trait Implementations

impl<T, B> Send for SmallArena<T, B> where
    B: Send,
    T: Send

impl<T, B> Sync for SmallArena<T, B> where
    B: Sync,
    T: Sync

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]