Struct allocators::scoped::Scoped
[−]
[src]
pub struct Scoped<'parent, A: 'parent + Allocator> { // some fields omitted }
A scoped linear allocator.
Methods
impl Scoped<'static, HeapAllocator>
impl<'parent, A: Allocator> Scoped<'parent, A>
fn new_from(alloc: &'parent A, size: usize) -> Result<Self, Error>
Creates a new Scoped
backed by size
bytes from the allocator supplied.
fn scope<F, U>(&self, f: F) -> Result<U, ()> where F: FnMut(&Self) -> U
Calls the supplied function with a new scope of the allocator.
Returns the result of the closure or an error if this allocator has already been scoped.