pub struct Arena<T> { /* private fields */ }Expand description
A container of items that can be accessed via a Key.
Implementations§
Source§impl<T> Arena<T>
impl<T> Arena<T>
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates a new Arena with enough space for capacity
number of items.
Sourcepub fn controller(&self) -> Controller
pub fn controller(&self) -> Controller
Returns a Controller for this Arena.
Sourcepub fn insert_with_key(
&mut self,
key: Key,
data: T,
) -> Result<(), InsertWithKeyError>
pub fn insert_with_key( &mut self, key: Key, data: T, ) -> Result<(), InsertWithKeyError>
Sourcepub fn retain(&mut self, f: impl FnMut(&T) -> bool)
pub fn retain(&mut self, f: impl FnMut(&T) -> bool)
Retains only the elements specified by the predicate.
In other words, remove all elements e such that f(&e) returns false.
Sourcepub fn iter(&self) -> Iter<'_, T> ⓘ
pub fn iter(&self) -> Iter<'_, T> ⓘ
Returns an iterator over shared references to the items in
the Arena.
The most recently added items will be visited first.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Returns an iterator over mutable references to the items in
the Arena.
The most recently added items will be visited first.
Sourcepub fn drain_filter<F: FnMut(&T) -> bool>(
&mut self,
filter: F,
) -> DrainFilter<'_, T, F> ⓘ
pub fn drain_filter<F: FnMut(&T) -> bool>( &mut self, filter: F, ) -> DrainFilter<'_, T, F> ⓘ
Returns an iterator that removes and yields all elements
for which filter(&element) returns true.
Trait Implementations§
Source§impl<'a, T> IntoIterator for &'a Arena<T>
impl<'a, T> IntoIterator for &'a Arena<T>
Source§impl<'a, T> IntoIterator for &'a mut Arena<T>
impl<'a, T> IntoIterator for &'a mut Arena<T>
Auto Trait Implementations§
impl<T> Freeze for Arena<T>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more