pub struct NoOpAllocator;Expand description
A GameAllocator that never actually allocates or drops memory.
allocate always returns AllocError and deallocate always panics.
This is intended to by used as the allocator for types such as OwnedPtr
that represent memory allocated by the game that don’t use the game’s main
heap and so whose deallocation behavior is unknown. It’s always incorrect to
try to create or destroy such types in Rust code.
Because NoOpAllocator::deallocate never has undefined behavior for any
memory blocks, all allocators are technically compatible with it.
Trait Implementations§
Source§impl GameAllocator for NoOpAllocator
impl GameAllocator for NoOpAllocator
Source§fn allocate(_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(_layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Always returns AllocError.
Auto Trait Implementations§
impl Freeze for NoOpAllocator
impl RefUnwindSafe for NoOpAllocator
impl Send for NoOpAllocator
impl Sync for NoOpAllocator
impl Unpin for NoOpAllocator
impl UnsafeUnpin for NoOpAllocator
impl UnwindSafe for NoOpAllocator
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