[][src]Struct basic_allocator::allocators::RawAlloc

pub struct RawAlloc<G> {
    pub grower: G,
    pub blocks: BlockList,
}

A raw allocator, capable of growing the heap, returning pointers to new allocations, and tracking and reusing freed memory.

Note: It never returns memory to the OS; that is not implemented.

This roughly corresponds to the AllocRef trait in Rust nightly, but does not directly implement that trait (although it probably could... TODO!)

Fields

grower: Gblocks: BlockList

Implementations

impl<G: HeapGrower> RawAlloc<G>[src]

pub fn new(grower: G) -> Self[src]

Create a new RawAlloc

pub fn stats(&self) -> (Validity, Stats)[src]

Get statistics on this allocator, and verify validity of the BlockList

pub fn block_size(layout: Layout) -> usize[src]

Calculate the minimum size of a block to be allocated for the given layout.

pub unsafe fn alloc(&mut self, layout: Layout) -> *mut u8[src]

Allocate space for something fitting in layout

Safety

This is very unsafe. See GlobalAlloc for details.

pub unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout)[src]

Deallocate (or "free") a memory block.

Safety

This is very unsafe. See GlobalAlloc for details.

Trait Implementations

impl<G: HeapGrower + Default> Default for RawAlloc<G>[src]

impl<G> Drop for RawAlloc<G>[src]

Auto Trait Implementations

impl<G> Send for RawAlloc<G> where
    G: Send

impl<G> !Sync for RawAlloc<G>

impl<G> Unpin for RawAlloc<G> where
    G: Unpin

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, 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.