Struct pomelo_hir::arena::Arena
source · pub struct Arena<T> {
inner: Vec<T>,
}
Expand description
Basically a Vec
.
Fields§
§inner: Vec<T>
Implementations§
source§impl<T> Arena<T>
impl<T> Arena<T>
pub fn new() -> Self
pub fn reserve(&mut self, n: usize)
pub fn capacity(&self) -> usize
pub fn alloc(&mut self, val: T) -> Idx<T>
pub fn items(&self) -> impl Iterator + '_
pub fn items_mut(&mut self) -> impl Iterator + '_
sourcepub fn get(&self, idx: Idx<T>) -> &T
pub fn get(&self, idx: Idx<T>) -> &T
This does not return an Option
because we assume the index is valid.
This should be alright, because we don’t provide a way to construct
an Idx
on its own.