pub struct AllocChain<'a, A, B>(/* private fields */);Expand description
A chain of allocators. If the first allocator is exhuasted, the second one is used as a fallback.
§Examples
// If the `SyncStalloc` is full, fall back to the system allocator.
use stalloc::{SyncStalloc, Stalloc};
use std::alloc::System;
let alloc_with_fallback = SyncStalloc::<1024, 8>::new().chain(&System);
let crazy_chain = Stalloc::<128, 4>::new()
.chain(&Stalloc::<1024, 8>::new())
.chain(&Stalloc::<8192, 16>::new())
.chain(&System);Implementations§
Trait Implementations§
Source§impl<A: GlobalAlloc + ChainableAlloc, B: GlobalAlloc> GlobalAlloc for AllocChain<'_, A, B>
impl<A: GlobalAlloc + ChainableAlloc, B: GlobalAlloc> GlobalAlloc for AllocChain<'_, A, B>
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl<'a, A, B> Freeze for AllocChain<'a, A, B>where
A: Freeze,
impl<'a, A, B> RefUnwindSafe for AllocChain<'a, A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<'a, A, B> Send for AllocChain<'a, A, B>
impl<'a, A, B> Sync for AllocChain<'a, A, B>
impl<'a, A, B> Unpin for AllocChain<'a, A, B>where
A: Unpin,
impl<'a, A, B> UnwindSafe for AllocChain<'a, A, B>where
A: UnwindSafe,
B: RefUnwindSafe,
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