Skip to main content

with_arena

Function with_arena 

Source
pub fn with_arena<T>(f: impl FnOnce(&mut Arena) -> T) -> T
Expand description

Calls the given function with the builtin arena allocator.

When the std feature is enabled, the builtin arena allocator is a thread-local variable, with one allocator per thread. When atomic pointers are supported, it is a global static and all threads share the same arena. Otherwise, this will create and drop a new arena each time it is called.