pub struct ScopeArena { /* private fields */ }
Expand description
An arena for allocating ScopeGuard
s.
Functions as a memory pool for allocating various trait objects needed for dropping type-erased
ElasticGuard
s. Each time the scope
method is called, the arena will have some allocations
made; to free these, ScopeArena::reset
should be called.
Implementations§
Source§impl ScopeArena
impl ScopeArena
Sourcepub fn scope<'a, F, R>(&'a self, f: F) -> Rwhere
F: FnOnce(&mut ScopeGuard<'a>) -> R,
pub fn scope<'a, F, R>(&'a self, f: F) -> Rwhere
F: FnOnce(&mut ScopeGuard<'a>) -> R,
Create a scope within which we can safely loan elastics.
This method does not reset the arena afterwards, so if you use it, it is your
responsibility to reset the ScopeArena
with ScopeArena::reset
to avoid memory leaks.
Trait Implementations§
Source§impl Debug for ScopeArena
impl Debug for ScopeArena
Source§impl Default for ScopeArena
impl Default for ScopeArena
Source§fn default() -> ScopeArena
fn default() -> ScopeArena
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ScopeArena
impl !RefUnwindSafe for ScopeArena
impl Send for ScopeArena
impl !Sync for ScopeArena
impl Unpin for ScopeArena
impl !UnwindSafe for ScopeArena
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