pub struct DummyAllocator;Expand description
A dummy allocator.
Allocation will always fail by returning a null pointer. Deallocation will always do nothing.
§Example
You may use it as the global allocator like so:
use dummy_alloc::DummyAllocator;
#[global_allocator]
static GLOBAL: DummyAllocator = DummyAllocator;See the alloc documentation for more information.
Trait Implementations§
Source§impl Clone for DummyAllocator
impl Clone for DummyAllocator
Source§fn clone(&self) -> DummyAllocator
fn clone(&self) -> DummyAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DummyAllocator
impl Debug for DummyAllocator
Source§impl Default for DummyAllocator
impl Default for DummyAllocator
Source§fn default() -> DummyAllocator
fn default() -> DummyAllocator
Returns the “default value” for a type. Read more
Source§impl GlobalAlloc for DummyAllocator
impl GlobalAlloc for DummyAllocator
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 moreimpl Copy for DummyAllocator
Auto Trait Implementations§
impl Freeze for DummyAllocator
impl RefUnwindSafe for DummyAllocator
impl Send for DummyAllocator
impl Sync for DummyAllocator
impl Unpin for DummyAllocator
impl UnwindSafe for DummyAllocator
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