Struct allocators::composable::Fallback
[−]
[src]
pub struct Fallback<M: BlockOwner, F: BlockOwner> { // some fields omitted }
This allocator has a main and a fallback allocator. It will always attempt to allocate first with the main allocator, and second with the fallback.
Methods
impl<M: BlockOwner, F: BlockOwner> Fallback<M, F>[src]
fn new(main: M, fallback: F) -> Self
Create a new Fallback
Trait Implementations
impl<M: BlockOwner, F: BlockOwner> Allocator for Fallback<M, F>[src]
unsafe fn allocate_raw(&self, size: usize, align: usize) -> Result<Block, AllocatorError>
Attempt to allocate a block of memory. Read more
unsafe fn deallocate_raw(&self, blk: Block)
Deallocate the memory referred to by this pointer. Read more
fn allocate<T>(&self, val: T) -> Result<Allocated<T, Self>, (AllocatorError, T)> where Self: Sized
Attempts to allocate the value supplied to it. Read more
fn make_place<T>(&self) -> Result<Place<T, Self>, AllocatorError> where Self: Sized
Attempts to create a place to allocate into. For the general purpose, calling allocate on the allocator is enough. However, when you know the value you are allocating is too large to be constructed on the stack, you should use in-place allocation. Read more
impl<M: BlockOwner, F: BlockOwner> BlockOwner for Fallback<M, F>[src]
fn owns_block(&self, blk: &Block) -> bool
Whether this allocator owns the block passed to it.
fn owns<'a, T, A: Allocator>(&self, val: &Allocated<'a, T, A>) -> bool
Whether this allocator owns this allocated value.
fn with_fallback<O: BlockOwner>(self, other: O) -> Fallback<Self, O> where Self: Sized
Joins this allocator with a fallback allocator.