pub struct ArenaPool { /* private fields */ }Expand description
Keeps the memory of dropped arenas so the arenas created after them can reuse it, instead of allocating it again for each file that’s formatted.
The memory is kept until it’s cleared or the pool is dropped, so store the pool for as long as it’s useful to reuse the memory (ex. in a plugin’s state). Each arena’s memory keeps the largest chunk it needed, so the pool holds about as much as the largest files that were formatted at the same time.
ⓘ
let arena = self.arena_pool.create_arena();
let print_items = generate(&arena, &file);
let text = print(print_items, options);Wasm plugins are given a pool in the format request (request.arena_pool).
Cloning the pool is cheap and the clones share the same memory.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Forget for ArenaPool
impl Freeze for ArenaPool
impl Move for ArenaPool
impl RefUnwindSafe for ArenaPool
impl Send for ArenaPool
impl Sync for ArenaPool
impl Unpin for ArenaPool
impl UnsafeUnpin for ArenaPool
impl UnwindSafe for ArenaPool
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