[][src]Struct refpool::Pool

pub struct Pool<A, S = PoolUnsync> where
    S: PoolSyncType<A>, 
{ /* fields omitted */ }

A pool of preallocated memory sized to match type A.

In order to use it to allocate objects, pass it to PoolRef::new() or PoolRef::default().

Example

let mut pool: Pool<usize> = Pool::new(1024);
let pool_ref = PoolRef::new(&mut pool, 31337);
assert_eq!(31337, *pool_ref);

Methods

impl<A, S> Pool<A, S> where
    S: PoolSyncType<A>, 
[src]

pub fn new(max_size: usize) -> Self[src]

Construct a new pool with a given max size.

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

Get the maximum size of the pool.

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

Get the current size of the pool.

pub fn is_full(&self) -> bool[src]

Test if the pool is currently full.

pub fn fill(&self)[src]

Fill the pool with empty allocations.

This operation will pre-allocate self.get_max_size() - self.get_pool_size() memory chunks, without initialisation, and put them in the pool.

Trait Implementations

impl<A, S> Clone for Pool<A, S> where
    S: PoolSyncType<A>, 
[src]

impl<A, S> Drop for Pool<A, S> where
    S: PoolSyncType<A>, 
[src]

Auto Trait Implementations

impl<A, S> RefUnwindSafe for Pool<A, S> where
    <S as PoolSyncType<A>>::PoolPointer: RefUnwindSafe

impl<A, S> Send for Pool<A, S> where
    <S as PoolSyncType<A>>::PoolPointer: Send

impl<A, S> Sync for Pool<A, S> where
    <S as PoolSyncType<A>>::PoolPointer: Sync

impl<A, S> Unpin for Pool<A, S> where
    <S as PoolSyncType<A>>::PoolPointer: Unpin

impl<A, S> UnwindSafe for Pool<A, S> where
    <S as PoolSyncType<A>>::PoolPointer: UnwindSafe

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = !

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.