pub struct MTArena<T>{ /* private fields */ }Expand description
MTArena is built on top of Arena but with support for sharing the arena between threads.
Also supports tree walking on a separate thread w/ a lambda that’s supplied.
- Wikipedia definition of memory arena
- You can learn more about how this library was built from this developerlife.com article.
Implementations§
Source§impl<T> MTArena<T>
impl<T> MTArena<T>
pub fn new() -> Self
pub fn get_arena_arc(&self) -> ShareableArena<T>
Sourcepub fn tree_walk_parallel(
&self,
node_id: usize,
walker_fn: Arc<WalkerFn<T>>,
traversal_kind: TraversalKind,
) -> JoinHandle<ResultUidList>
pub fn tree_walk_parallel( &self, node_id: usize, walker_fn: Arc<WalkerFn<T>>, traversal_kind: TraversalKind, ) -> JoinHandle<ResultUidList>
walker_fn is a closure that captures variables. It is wrapped in an Arc to be able to
clone that and share it across threads. More info:
- SO thread: https://stackoverflow.com/a/36213377/2085356
- Scoped threads: https://docs.rs/crossbeam/0.3.0/crossbeam/struct.Scope.html
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for MTArena<T>
impl<T> RefUnwindSafe for MTArena<T>
impl<T> Send for MTArena<T>
impl<T> Sync for MTArena<T>
impl<T> Unpin for MTArena<T>
impl<T> UnwindSafe for MTArena<T>
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