pub struct QueryArena { /* private fields */ }Expand description
Arena allocator for query building.
Provides fast allocation with batch deallocation when the scope ends.
Implementations§
Source§impl QueryArena
impl QueryArena
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create an arena with specified initial capacity.
Sourcepub fn scope<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&ArenaScope<'_>) -> R,
pub fn scope<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&ArenaScope<'_>) -> R,
Execute a closure with an arena scope.
The scope provides allocation methods. All allocations are valid within the closure and freed when it returns.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the arena for reuse.
This is O(1) - just resets the bump pointer.
Sourcepub fn allocated_bytes(&self) -> usize
pub fn allocated_bytes(&self) -> usize
Get the number of bytes currently allocated.
Sourcepub fn stats(&self) -> ArenaStats
pub fn stats(&self) -> ArenaStats
Get arena statistics.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QueryArena
impl !RefUnwindSafe for QueryArena
impl Send for QueryArena
impl !Sync for QueryArena
impl Unpin for QueryArena
impl !UnwindSafe for QueryArena
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