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
sourceimpl<T: Clone, const ALIGN: usize> Clone for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: Clone, const ALIGN: usize> Clone for GlobalAllocAsFlexSource<T, ALIGN>
sourcefn clone(&self) -> GlobalAllocAsFlexSource<T, ALIGN>
fn clone(&self) -> GlobalAllocAsFlexSource<T, ALIGN>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: ConstDefault, const ALIGN: usize> ConstDefault for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: ConstDefault, const ALIGN: usize> ConstDefault for GlobalAllocAsFlexSource<T, ALIGN>
sourceimpl<T: Debug, const ALIGN: usize> Debug for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: Debug, const ALIGN: usize> Debug for GlobalAllocAsFlexSource<T, ALIGN>
sourceimpl<T: Default, const ALIGN: usize> Default for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: Default, const ALIGN: usize> Default for GlobalAllocAsFlexSource<T, ALIGN>
sourcefn default() -> GlobalAllocAsFlexSource<T, ALIGN>
fn default() -> GlobalAllocAsFlexSource<T, ALIGN>
Returns the “default value” for a type. Read more
sourceimpl<T: GlobalAlloc, const ALIGN: usize> FlexSource for GlobalAllocAsFlexSource<T, ALIGN>
impl<T: GlobalAlloc, const ALIGN: usize> FlexSource for GlobalAllocAsFlexSource<T, ALIGN>
sourceunsafe 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
sourceunsafe fn dealloc(&mut self, ptr: NonNull<[u8]>)
unsafe fn dealloc(&mut self, ptr: NonNull<[u8]>)
Deallocate a previously allocated memory block. Read more
sourcefn supports_dealloc(&self) -> bool
fn supports_dealloc(&self) -> bool
Check if this allocator implements Self::dealloc
. Read more
sourcefn 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 more
sourceunsafe 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 more
sourcefn supports_realloc_inplace_grow(&self) -> bool
fn supports_realloc_inplace_grow(&self) -> bool
Check if this allocator implements Self::realloc_inplace_grow
. Read more
sourcefn 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
impl<T: Copy, const ALIGN: usize> Copy for GlobalAllocAsFlexSource<T, ALIGN>
Auto Trait Implementations
impl<T, const ALIGN: usize> RefUnwindSafe for GlobalAllocAsFlexSource<T, ALIGN> where
T: RefUnwindSafe,
impl<T, const ALIGN: usize> Send for GlobalAllocAsFlexSource<T, ALIGN> where
T: Send,
impl<T, const ALIGN: usize> Sync for GlobalAllocAsFlexSource<T, ALIGN> where
T: Sync,
impl<T, const ALIGN: usize> Unpin for GlobalAllocAsFlexSource<T, ALIGN> where
T: Unpin,
impl<T, const ALIGN: usize> UnwindSafe for GlobalAllocAsFlexSource<T, ALIGN> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more