[−][src]Struct compact_arena::SmallArena
A "Small" arena based on a resizable slice (i.e. a Vec
) that can be
indexed with 32-bit Idx32
s. This can help reduce memory overhead when
using many pointer-heavy objects on 64-bit systems.
You can obtain an instance of this type by calling mk_arena
.
Implementations
impl<'tag, T> SmallArena<'tag, T>
[src]
pub unsafe fn new(tag: InvariantLifetime<'tag>, capacity: usize) -> Self
[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 '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 unsafe fn from_vec(tag: InvariantLifetime<'tag>, data: Vec<T>) -> Self
[src]
move a Vec
into a SmallArena. This is unlikely to be useful to you,
it's an implementation detail of the recycle_arena!
macro.
pub fn into_inner(self) -> Vec<T>
[src]
consume the arena and get the data out
pub fn try_add(&mut self, item: T) -> Result<Idx32<'tag>, CapacityExceeded<T>>
[src]
Add an item to the arena, get an index or CapacityExceeded back.
pub fn add(&mut self, item: T) -> Idx32<'tag>
[src]
Add an item to the arena, get an index back.
Trait Implementations
impl<'tag, T> Index<Idx<'tag, u32>> for SmallArena<'tag, T>
[src]
type Output = T
The returned type after indexing.
fn index(&self, i: Idx32<'tag>) -> &T
[src]
Gets an immutable reference to the value at this index.
impl<'tag, T> IndexMut<Idx<'tag, u32>> for SmallArena<'tag, T>
[src]
Auto Trait Implementations
impl<'tag, T> RefUnwindSafe for SmallArena<'tag, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'tag, T> Send for SmallArena<'tag, T> where
T: Send,
T: Send,
impl<'tag, T> Sync for SmallArena<'tag, T> where
T: Sync,
T: Sync,
impl<'tag, T> Unpin for SmallArena<'tag, T> where
T: Unpin,
T: Unpin,
impl<'tag, T> UnwindSafe for SmallArena<'tag, T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,