[][src]Struct refpool::Pool

pub struct Pool<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> Pool<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 set_max_size(&mut self, max_size: usize)[src]

Set a new max size for the pool.

This will not reduce the size of the pool if you set it to a lower number than its current size, but it will prevent it from growing while the pool size exceeds the new max size.

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.

Auto Trait Implementations

impl<A> !Send for Pool<A>

impl<A> !Sync for Pool<A>

impl<A> Unpin for Pool<A>

impl<A> UnwindSafe for Pool<A> where
    A: RefUnwindSafe

impl<A> RefUnwindSafe for Pool<A> where
    A: RefUnwindSafe

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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