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>

source§

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)

Performs copy-assignment from source. Read more
source§

impl<T: ConstDefault, const ALIGN: usize> ConstDefault for GlobalAllocAsFlexSource<T, ALIGN>

source§

const DEFAULT: Self = _

The constant default value.
source§

impl<T: Debug, const ALIGN: usize> Debug for GlobalAllocAsFlexSource<T, ALIGN>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default, const ALIGN: usize> Default for GlobalAllocAsFlexSource<T, ALIGN>

source§

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>

source§

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]>)

Deallocate a previously allocated memory block. Read more
source§

fn supports_dealloc(&self) -> bool

Check if this allocator implements Self::dealloc. Read more
source§

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
source§

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
source§

fn supports_realloc_inplace_grow(&self) -> bool

Check if this allocator implements Self::realloc_inplace_grow. Read more
source§

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
source§

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.