Struct rlsf::FlexTlsf[][src]

pub struct FlexTlsf<Source: FlexSource, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> { /* fields omitted */ }
Expand description

A wrapper of Tlsf that automatically acquires fresh memory pools from FlexSource.

Implementations

impl<Source: FlexSource, FLBitmap: BinInteger, SLBitmap: BinInteger, const FLLEN: usize, const SLLEN: usize> FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN>[src]

pub fn new(source: Source) -> Self[src]

Construct a new FlexTlsf object.

pub fn source_ref(&self) -> &Source[src]

Borrow the contained Source.

pub unsafe fn source_mut_unchecked(&mut self) -> &mut Source[src]

Mutably borrow the contained Source.

Safety

The caller must not replace the Source with another one or modify any existing allocations in the Source.

pub fn allocate(&mut self, layout: Layout) -> Option<NonNull<u8>>[src]

Attempt to allocate a block of memory.

Returns the starting address of the allocated memory block on success; None otherwise.

Time Complexity

This method will complete in constant time (assuming Source’s methods do so as well).

pub unsafe fn deallocate(&mut self, ptr: NonNull<u8>, align: usize)[src]

Deallocate a previously allocated memory block.

Time Complexity

This method will complete in constant time (assuming Source’s methods do so as well).

Safety

  • ptr must denote a memory block previously allocated via self.
  • The memory block must have been allocated with the same alignment (Layout::align) as align.

pub unsafe fn reallocate(
    &mut self,
    ptr: NonNull<u8>,
    new_layout: Layout
) -> Option<NonNull<u8>>
[src]

Shrink or grow a previously allocated memory block.

Returns the new starting address of the memory block on success; None otherwise.

Time Complexity

Unlike other methods, this method will complete in linear time (O(old_size)), assuming Source’s methods do so as well.

Safety

  • ptr must denote a memory block previously allocated via self.
  • The memory block must have been allocated with the same alignment (Layout::align) as new_layout.

Trait Implementations

impl<Source: Debug + FlexSource, FLBitmap: Debug, SLBitmap: Debug, const FLLEN: usize, const SLLEN: usize> Debug for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN>[src]

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

Formats the value using the given formatter. Read more

impl<Source: FlexSource + Default, FLBitmap: BinInteger, SLBitmap: BinInteger, const FLLEN: usize, const SLLEN: usize> Default for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN>[src]

Initialization with a FlexSource provided by Default::default

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<Source: FlexSource, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> Drop for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<Source: FlexSource + Init, FLBitmap: BinInteger, SLBitmap: BinInteger, const FLLEN: usize, const SLLEN: usize> Init for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN>[src]

Initialization with a FlexSource provided by Init::INIT

const INIT: Self[src]

An empty pool.

Auto Trait Implementations

impl<Source, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> RefUnwindSafe for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN> where
    FLBitmap: RefUnwindSafe,
    SLBitmap: RefUnwindSafe,
    Source: RefUnwindSafe

impl<Source, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> Send for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN> where
    Source: Send

impl<Source, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> Sync for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN> where
    Source: Sync

impl<Source, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> Unpin for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN> where
    FLBitmap: Unpin,
    SLBitmap: Unpin,
    Source: Unpin

impl<Source, FLBitmap, SLBitmap, const FLLEN: usize, const SLLEN: usize> !UnwindSafe for FlexTlsf<Source, FLBitmap, SLBitmap, FLLEN, SLLEN>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.