Struct atomic_arena::Arena
source · [−]pub struct Arena<T> { /* private fields */ }
Expand description
A container of items that can be accessed via a Key
.
Implementations
sourceimpl<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>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = (Key, &'a T);
pub fn iter(&self) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = (Key, &'a 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>ⓘNotable traits for IterMut<'a, T>impl<'a, T> Iterator for IterMut<'a, T> type Item = (Key, &'a mut T);
pub fn iter_mut(&mut self) -> IterMut<'_, T>ⓘNotable traits for IterMut<'a, T>impl<'a, T> Iterator for IterMut<'a, T> type Item = (Key, &'a mut 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>ⓘNotable traits for DrainFilter<'a, T, F>impl<'a, T, F: FnMut(&T) -> bool> Iterator for DrainFilter<'a, T, F> type Item = (Key, T);
pub fn drain_filter<F: FnMut(&T) -> bool>(
&mut self,
filter: F
) -> DrainFilter<'_, T, F>ⓘNotable traits for DrainFilter<'a, T, F>impl<'a, T, F: FnMut(&T) -> bool> Iterator for DrainFilter<'a, T, F> type Item = (Key, T);
Returns an iterator that removes and yields all elements
for which filter(&element)
returns true
.
Trait Implementations
sourceimpl<'a, T> IntoIterator for &'a Arena<T>
impl<'a, T> IntoIterator for &'a Arena<T>
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