[][src]Struct swim_mem::alloc::Pool

pub struct Pool<'a> { /* fields omitted */ }

Linear allocator for a dynamically growable set of memory blocks.

A Pool allocates space in a sequence of linear memory Packs allocated by a Heap. Pools only reclaim space when the most recent allocation drops, and when the whole pool drops. To free a pool, use IntoHold to move live values to another hold, then drop the pool.

Methods

impl<'a> Pool<'a>[src]

pub fn new(heap: &'a dyn Heap<'a>) -> Pool<'a>[src]

Returns a new Pool that allocates memory from the given heap.

pub fn heap(&self) -> &'a dyn Heap<'a>[src]

Returns the Heap used to allocate memory for the internal pack list.

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

Returns the number of reserved bytes in this Pool.

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

Return the number of live allocations in this Pool.

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

Returns the number of bytes currently allocated in this Pool.

Trait Implementations

impl<'a> Hold<'a> for Pool<'a>[src]

unsafe fn realloc(
    &self,
    block: Block<'a>,
    layout: Layout
) -> Result<Block<'a>, HoldError>
[src]

Attempts to resize a memory block allocated by this Hold to fit a new layout. Returns Ok with the resized memory block on success; returns a HoldError on failure. Read more

impl<'a> Drop for Pool<'a>[src]

Auto Trait Implementations

impl<'a> !Send for Pool<'a>

impl<'a> !Sync for Pool<'a>

Blanket Implementations

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

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