Struct generational_lru::arena::Arena
source · [−]pub struct Arena<T> {
items: Vec<Entry<T>>,
capacity: usize,
generation: u64,
free_list_head: Option<usize>,
}
Expand description
A generational arena for allocating memory based off a vector. Every entry is associated with a generation counter to uniquely identify newer allocations from older reclaimed allocations at the same position in the vector. This is inspired from the crate “generational-arena”
Fields
items: Vec<Entry<T>>
capacity: usize
generation: u64
free_list_head: Option<usize>
Implementations
sourceimpl<T> Arena<T>
impl<T> Arena<T>
pub fn new() -> Self
pub fn capacity(&self) -> usize
pub fn reserve(&mut self, capacity: usize)
pub fn with_capacity(capacity: usize) -> Self
pub fn insert(&mut self, item: T) -> Result<Index, ArenaOOM>
pub fn remove(&mut self, index: &Index) -> Option<T>
pub fn get_mut(&mut self, index: &Index) -> Option<&mut T>
pub fn get(&self, index: &Index) -> Option<&T>
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more