Struct allocators::scoped::Scoped [] [src]

pub struct Scoped<'parent, A: 'parent + Allocator> {
    // some fields omitted
}

A scoped linear allocator.

Methods

impl Scoped<'static, HeapAllocator>

fn new(size: usize) -> Result<Self, Error>

Creates a new Scoped backed by size bytes from the heap.

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.

fn is_scoped(&self) -> bool

Trait Implementations

impl<'a, A: Allocator> Allocator for Scoped<'a, A>

unsafe fn allocate_raw(&self, size: usize, align: usize) -> Result<Block, Error>

unsafe fn reallocate_raw<'b>(&'b self, block: Block<'b>, new_size: usize) -> Result<Block<'b>, (Error, Block<'b>)>

unsafe fn deallocate_raw(&self, block: Block)

fn allocate<T>(&self, val: T) -> Result<AllocBox<T, Self>, (Error, T)> where Self: Sized

fn make_place<T>(&self) -> Result<Place<T, Self>, Error> where Self: Sized

impl<'a, A: Allocator> BlockOwner for Scoped<'a, A>

fn owns_block(&self, block: &Block) -> bool

fn owns<'a, T, A: Allocator>(&self, val: &AllocBox<'a, T, A>) -> bool

fn with_fallback<O: BlockOwner>(self, other: O) -> Fallback<Self, O> where Self: Sized

impl<'a, A: Allocator> Drop for Scoped<'a, A>

fn drop(&mut self)

impl<'a, A: 'a + Allocator + Sync> Send for Scoped<'a, A>