Struct xalloc::tlsf::Tlsf

source ·
pub struct Tlsf<T, A, P>where
    A: UnsafeArena<TlsfBlock<T, P>, Ptr = P>,
    P: Clone + Default + PartialEq + Eq + Debug,
{ /* private fields */ }
Expand description

TLSF-based external memory allocator.

See the module-level documentation for more.

Type parameters

  • T is an integer type used to represent region sizes. You usually use u32 or u64 for this.
  • A is a memory arena type used to allocate internal block structures.

Implementations

Construct a SafeTlsf.

Construct a SysTlsf.

Construct a SysTlsf with a specific capacity.

Construct a Tlsf.

Get a reference to the underlying memory arena.

Get a mutable reference to the underlying memory arena.

Allocate a region of the size size with a given alignment requirement.

Returns a handle of the allocated region and its offset if the allocation succeeds. Returns None otherwise.

  • align must be a power of two.
  • size must not be zero.

Allocate a region of the size size.

Returns a handle of the allocated region and its offset if the allocation succeeds. Returns None otherwise.

size must not be zero.

Deallocate the specified region, without checking the origin of the TlsfRegion.

This might result in an undefined behavior if r originates from a different instance of Tlsf.

Deallocate the specified region.

Returns Err(r) if r does not originate from the same instance of Tlsf.

Deallocate the specified region.

r must originate from the same instance of Tlsf. Otherwise, Tlsf enters an inconsistent state and possibly panics, but does not cause an undefined behavior.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.