Struct rlsf::GlobalAllocAsFlexSource
source · pub struct GlobalAllocAsFlexSource<T, const ALIGN: usize>(pub T);
Expand description
Wraps core::alloc::GlobalAlloc
to implement the FlexSource
trait.
Since this type does not implement FlexSource::realloc_inplace_grow
,
it is likely to end up with terribly fragmented memory pools.
Tuple Fields§
§0: T
Trait Implementations§
source§impl<T: Clone, const ALIGN: usize> Clone for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: Clone, const ALIGN: usize> Clone for GlobalAllocAsFlexSource<T, ALIGN>
source§fn clone(&self) -> GlobalAllocAsFlexSource<T, ALIGN>
fn clone(&self) -> GlobalAllocAsFlexSource<T, ALIGN>
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<T: ConstDefault, const ALIGN: usize> ConstDefault for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: ConstDefault, const ALIGN: usize> ConstDefault for GlobalAllocAsFlexSource<T, ALIGN>
source§impl<T: Default, const ALIGN: usize> Default for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: Default, const ALIGN: usize> Default for GlobalAllocAsFlexSource<T, ALIGN>
source§fn default() -> GlobalAllocAsFlexSource<T, ALIGN>
fn default() -> GlobalAllocAsFlexSource<T, ALIGN>
Returns the “default value” for a type. Read more
source§impl<T: GlobalAlloc, const ALIGN: usize> FlexSource for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: GlobalAlloc, const ALIGN: usize> FlexSource for GlobalAllocAsFlexSource<T, ALIGN>
source§unsafe fn alloc(&mut self, min_size: usize) -> Option<NonNull<[u8]>>
unsafe fn alloc(&mut self, min_size: usize) -> Option<NonNull<[u8]>>
Allocate a memory block of the requested minimum size. Read more
source§unsafe fn dealloc(&mut self, ptr: NonNull<[u8]>)
unsafe fn dealloc(&mut self, ptr: NonNull<[u8]>)
Deallocate a previously allocated memory block. Read more
source§fn supports_dealloc(&self) -> bool
fn supports_dealloc(&self) -> bool
Check if this allocator implements
Self::dealloc
. Read moresource§fn min_align(&self) -> usize
fn min_align(&self) -> usize
Get the minimum alignment of allocations made by this allocator.
FlexTlsf
may be less efficient if this method returns a value
less than GRANULARITY
. Read moresource§unsafe fn realloc_inplace_grow(
&mut self,
ptr: NonNull<[u8]>,
min_new_len: usize
) -> Option<usize>
unsafe fn realloc_inplace_grow( &mut self, ptr: NonNull<[u8]>, min_new_len: usize ) -> Option<usize>
Attempt to grow the specified allocation without moving it. Returns
the final allocation size (which must be greater than or equal to
min_new_len
) on success. Read moresource§fn supports_realloc_inplace_grow(&self) -> bool
fn supports_realloc_inplace_grow(&self) -> bool
Check if this allocator implements
Self::realloc_inplace_grow
. Read moresource§fn is_contiguous_growable(&self) -> bool
fn is_contiguous_growable(&self) -> bool
Returns
true
if this allocator is implemented by managing one
contiguous region, which is grown every time alloc
or
realloc_inplace_grow
is called. Read more