Struct bump_scope::WithoutShrink
source · pub struct WithoutShrink<A>(pub A);Expand description
Wraps an bump allocator and does nothing on shrink.
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> WithoutShrink<A>
impl<A> WithoutShrink<A>
sourcepub fn without_dealloc(self) -> WithoutDealloc<Self>
pub fn without_dealloc(self) -> WithoutDealloc<Self>
Wraps self in WithoutDealloc so that deallocate becomes a no-op.
Trait Implementations§
source§impl<A: BumpAllocator> Allocator for WithoutShrink<A>
impl<A: BumpAllocator> Allocator for WithoutShrink<A>
source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
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>
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)
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>
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>
Behaves like
grow, but also ensures that the new contents are set to zero before being
returned. Read moresource§impl<A: Clone> Clone for WithoutShrink<A>
impl<A: Clone> Clone for WithoutShrink<A>
source§fn clone(&self) -> WithoutShrink<A>
fn clone(&self) -> WithoutShrink<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 WithoutShrink<A>
impl<A: Debug> Debug for WithoutShrink<A>
source§impl<A: Hash> Hash for WithoutShrink<A>
impl<A: Hash> Hash for WithoutShrink<A>
source§impl<A: Ord> Ord for WithoutShrink<A>
impl<A: Ord> Ord for WithoutShrink<A>
source§fn cmp(&self, other: &WithoutShrink<A>) -> Ordering
fn cmp(&self, other: &WithoutShrink<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 WithoutShrink<A>
impl<A: PartialEq> PartialEq for WithoutShrink<A>
source§fn eq(&self, other: &WithoutShrink<A>) -> bool
fn eq(&self, other: &WithoutShrink<A>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<A: PartialOrd> PartialOrd for WithoutShrink<A>
impl<A: PartialOrd> PartialOrd for WithoutShrink<A>
source§fn partial_cmp(&self, other: &WithoutShrink<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &WithoutShrink<A>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<A: BumpAllocator> BumpAllocator for WithoutShrink<A>
impl<A: Copy> Copy for WithoutShrink<A>
impl<A: Eq> Eq for WithoutShrink<A>
impl<A> StructuralPartialEq for WithoutShrink<A>
Auto Trait Implementations§
impl<A> Freeze for WithoutShrink<A>where
A: Freeze,
impl<A> RefUnwindSafe for WithoutShrink<A>where
A: RefUnwindSafe,
impl<A> Send for WithoutShrink<A>where
A: Send,
impl<A> Sync for WithoutShrink<A>where
A: Sync,
impl<A> Unpin for WithoutShrink<A>where
A: Unpin,
impl<A> UnwindSafe for WithoutShrink<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