pub struct DefaultAlloc;Expand description
Default allocator, delegating to the global allocator.
Trait Implementations§
Source§impl Alloc for DefaultAlloc
impl Alloc for DefaultAlloc
Source§impl AllocDescriptor for DefaultAlloc
impl AllocDescriptor for DefaultAlloc
Source§const FEATURES: AllocFeatures = _
const FEATURES: AllocFeatures = _
Bitflags for the allocator’s supported features.
Source§const MIN_ALIGN: NonZeroUsize = _
const MIN_ALIGN: NonZeroUsize = _
The minimum alignment returned by all allocation calls made to this allocator.
Source§fn supports(features: AllocFeatures) -> bool
fn supports(features: AllocFeatures) -> bool
Returns whether this allocator supports the featureset represented by the provided bitflags.
Source§impl Allocator for DefaultAlloc
impl Allocator for DefaultAlloc
Source§fn allocate(&self, layout: StdLayout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: StdLayout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to allocate a block of memory. Read more
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: StdLayout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: StdLayout)
🔬This is a nightly-only experimental API. (
allocator_api)Deallocates the memory referenced by
ptr. Read moreSource§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 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§impl Clone for DefaultAlloc
impl Clone for DefaultAlloc
Source§fn clone(&self) -> DefaultAlloc
fn clone(&self) -> DefaultAlloc
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DefaultAlloc
Source§impl Dealloc for DefaultAlloc
impl Dealloc for DefaultAlloc
Source§unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout)
Deallocates a previously allocated block. Read more
Source§unsafe fn try_dealloc(
&self,
ptr: NonNull<u8>,
layout: Layout,
) -> Result<(), Error>
unsafe fn try_dealloc( &self, ptr: NonNull<u8>, layout: Layout, ) -> Result<(), Error>
Attempts to deallocate a previously allocated block. If this allocator is backed by an
allocation library which does not provide fallible deallocation operations, this may panic,
abort, or incorrectly return
Ok(()). Read moreSource§impl Debug for DefaultAlloc
impl Debug for DefaultAlloc
Source§impl Default for DefaultAlloc
impl Default for DefaultAlloc
Source§fn default() -> DefaultAlloc
fn default() -> DefaultAlloc
Returns the “default value” for a type. Read more
impl Eq for DefaultAlloc
Source§impl Hash for DefaultAlloc
impl Hash for DefaultAlloc
Source§impl Ord for DefaultAlloc
impl Ord for DefaultAlloc
Source§fn cmp(&self, other: &DefaultAlloc) -> Ordering
fn cmp(&self, other: &DefaultAlloc) -> Ordering
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for DefaultAlloc
impl PartialEq for DefaultAlloc
Source§impl PartialOrd for DefaultAlloc
impl PartialOrd for DefaultAlloc
Source§impl Realloc for DefaultAlloc
impl Realloc for DefaultAlloc
Source§unsafe fn realloc(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
unsafe fn realloc( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
Reallocates a block, growing or shrinking as needed. The new alignment may be larger or the
same, but cannot be smaller. Read more
Source§unsafe fn rezalloc(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
unsafe fn rezalloc( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
Reallocates a block, growing or shrinking as needed, with extra bytes being zeroed. The new
alignment may be larger or the same, but cannot be smaller. Read more
impl StructuralPartialEq for DefaultAlloc
Source§impl ZstAlloc for DefaultAlloc
impl ZstAlloc for DefaultAlloc
Source§impl ZstDealloc for DefaultAlloc
impl ZstDealloc for DefaultAlloc
Source§unsafe fn dealloc(ptr: NonNull<u8>, layout: Layout)
unsafe fn dealloc(ptr: NonNull<u8>, layout: Layout)
Deallocates a previously allocated block. Read more
Source§unsafe fn try_dealloc(ptr: NonNull<u8>, layout: Layout) -> Result<(), Error>
unsafe fn try_dealloc(ptr: NonNull<u8>, layout: Layout) -> Result<(), Error>
Attempts to deallocate a previously allocated block. If this allocator is backed by an
allocation library which does not provide fallible deallocation operations, this may panic,
abort, or incorrectly return
Ok(()). Read moreSource§impl ZstRealloc for DefaultAlloc
impl ZstRealloc for DefaultAlloc
Source§unsafe fn realloc(
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
unsafe fn realloc( ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
Reallocates a block, growing or shrinking as needed. The new alignment may be larger or the
same, but cannot be smaller. Read more
Source§unsafe fn rezalloc(
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
unsafe fn rezalloc( ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<u8>, <Self as AllocDescriptor>::Error>
Reallocates a block, growing or shrinking as needed, with extra bytes being zeroed. The new
alignment may be larger or the same, but cannot be smaller. Read more
Auto Trait Implementations§
impl Freeze for DefaultAlloc
impl RefUnwindSafe for DefaultAlloc
impl Send for DefaultAlloc
impl Sync for DefaultAlloc
impl Unpin for DefaultAlloc
impl UnsafeUnpin for DefaultAlloc
impl UnwindSafe for DefaultAlloc
Blanket Implementations§
Source§impl<A> AllocMut for A
impl<A> AllocMut for A
Source§impl<A> AllocTemp for Awhere
A: BasicAlloc,
impl<A> AllocTemp for Awhere
A: BasicAlloc,
Source§unsafe fn alloc_temp<R, F>(
&self,
layout: Layout,
with_mem: F,
) -> Result<R, <A as AllocDescriptor>::Error>
unsafe fn alloc_temp<R, F>( &self, layout: Layout, with_mem: F, ) -> Result<R, <A as AllocDescriptor>::Error>
impl<A> BasicAlloc for A
impl<A> BasicAllocMut for Awhere
A: AllocMut + DeallocMut,
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§impl<A> DeallocMut for A
impl<A> DeallocMut for A
Source§unsafe fn dealloc_mut(&mut self, ptr: NonNull<u8>, layout: Layout)
unsafe fn dealloc_mut(&mut self, ptr: NonNull<u8>, layout: Layout)
Deallocates a previously allocated block. Read more
Source§unsafe fn try_dealloc_mut(
&mut self,
ptr: NonNull<u8>,
layout: Layout,
) -> Result<(), <A as AllocDescriptor>::Error>
unsafe fn try_dealloc_mut( &mut self, ptr: NonNull<u8>, layout: Layout, ) -> Result<(), <A as AllocDescriptor>::Error>
Attempts to deallocate a previously allocated block. If this allocator is backed by an
allocation library which does not provide fallible deallocation operations, this may panic,
abort, or incorrectly return
Ok(()). Read moreimpl<A> FullAlloc for A
impl<A> FullAllocMut for A
Source§impl<T> KnownAlign for T
impl<T> KnownAlign for T
Source§impl<A> ReallocMut for A
impl<A> ReallocMut for A
Source§unsafe fn realloc_mut(
&mut self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<u8>, <A as AllocDescriptor>::Error>
unsafe fn realloc_mut( &mut self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<u8>, <A as AllocDescriptor>::Error>
Reallocates a block, growing or shrinking as needed. The new alignment may be larger or the
same, but cannot be smaller. Read more
Source§unsafe fn rezalloc_mut(
&mut self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<u8>, <A as AllocDescriptor>::Error>
unsafe fn rezalloc_mut( &mut self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<u8>, <A as AllocDescriptor>::Error>
Reallocates a block, growing or shrinking as needed, with extra bytes being zeroed. The new
alignment may be larger or the same, but cannot be smaller. Read more
Source§impl<T> SizedProps for T
impl<T> SizedProps for T
Source§const MAX_SLICE_LEN: usize = _
const MAX_SLICE_LEN: usize = _
The largest safe length for a
[Self].