Skip to main content

with_arena

Function with_arena 

Source
pub fn with_arena<F, R>(f: F) -> R
where F: FnOnce(&Bump) -> R,
Expand description

Execute a function with access to the thread-local arena.

The &Bump is live only for the duration of the closure, so the closure must consume any borrowed &str it allocates. To retain an allocated string past the call, wrap it with SeqString via seqstring::arena_string (the canonical user-facing entry point).

ยงPerformance

~5ns vs ~100ns for global allocator (20x faster).