Struct bump_scope::WithoutDealloc
source · pub struct WithoutDealloc<A>(pub A);Expand description
Wraps an bump allocator and does nothing on deallocate.
This type only implements Allocator for wrapped types that implement BumpAllocator, so you don’t accidentally leak memory.
Tuple Fields§
§0: AImplementations§
source§impl<A> WithoutDealloc<A>
impl<A> WithoutDealloc<A>
sourcepub fn without_shrink(self) -> WithoutShrink<Self>
pub fn without_shrink(self) -> WithoutShrink<Self>
Wraps self in WithoutShrink so that shrink becomes a no-op.
Trait Implementations§
source§impl<A: BumpAllocator> Allocator for WithoutDealloc<A>
impl<A: BumpAllocator> Allocator for WithoutDealloc<A>
source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to allocate a block of memory. Read more
source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Behaves like
allocate, but also ensures that the returned memory is zero-initialized. Read moresource§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (
allocator_api)Deallocates the memory referenced by
ptr. Read moresource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to extend the memory block. Read more
source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Behaves like
grow, but also ensures that the new contents are set to zero before being
returned. Read moresource§impl<A: Clone> Clone for WithoutDealloc<A>
impl<A: Clone> Clone for WithoutDealloc<A>
source§fn clone(&self) -> WithoutDealloc<A>
fn clone(&self) -> WithoutDealloc<A>
Returns a copy 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<A: Debug> Debug for WithoutDealloc<A>
impl<A: Debug> Debug for WithoutDealloc<A>
source§impl<A: Hash> Hash for WithoutDealloc<A>
impl<A: Hash> Hash for WithoutDealloc<A>
source§impl<A: Ord> Ord for WithoutDealloc<A>
impl<A: Ord> Ord for WithoutDealloc<A>
source§fn cmp(&self, other: &WithoutDealloc<A>) -> Ordering
fn cmp(&self, other: &WithoutDealloc<A>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<A: PartialEq> PartialEq for WithoutDealloc<A>
impl<A: PartialEq> PartialEq for WithoutDealloc<A>
source§impl<A: PartialOrd> PartialOrd for WithoutDealloc<A>
impl<A: PartialOrd> PartialOrd for WithoutDealloc<A>
impl<A: BumpAllocator> BumpAllocator for WithoutDealloc<A>
impl<A: Copy> Copy for WithoutDealloc<A>
impl<A: Eq> Eq for WithoutDealloc<A>
impl<A> StructuralPartialEq for WithoutDealloc<A>
Auto Trait Implementations§
impl<A> Freeze for WithoutDealloc<A>where
A: Freeze,
impl<A> RefUnwindSafe for WithoutDealloc<A>where
A: RefUnwindSafe,
impl<A> Send for WithoutDealloc<A>where
A: Send,
impl<A> Sync for WithoutDealloc<A>where
A: Sync,
impl<A> Unpin for WithoutDealloc<A>where
A: Unpin,
impl<A> UnwindSafe for WithoutDealloc<A>where
A: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)