[][src]Struct alloc_cortex_m::CortexMHeap

pub struct CortexMHeap { /* fields omitted */ }

Implementations

impl CortexMHeap[src]

pub const fn empty() -> CortexMHeap[src]

Crate a new UNINITIALIZED heap allocator

You must initialize this heap using the init method before using the allocator.

pub unsafe fn init(&self, start_addr: usize, size: usize)[src]

Initializes the heap

This function must be called BEFORE you run any code that makes use of the allocator.

start_addr is the address where the heap will be located.

size is the size of the heap in bytes.

Note that:

  • The heap grows "upwards", towards larger addresses. Thus end_addr must be larger than start_addr

  • The size of the heap is (end_addr as usize) - (start_addr as usize). The allocator won't use the byte at end_addr.

Safety

Obey these or Bad Stuff will happen.

  • This function must be called exactly ONCE.
  • size > 0

pub fn used(&self) -> usize[src]

Returns an estimate of the amount of bytes in use.

pub fn free(&self) -> usize[src]

Returns an estimate of the amount of bytes available.

Trait Implementations

impl GlobalAlloc for CortexMHeap[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

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.