Struct pool::Pool [-] [+] [src]

pub struct Pool<T> {
    // some fields omitted
}

A pool of reusable values

Methods

impl<T> Pool<T>

fn with_capacity<F>(count: usize, extra: usize, init: F) -> Pool<T> where F: Fn() -> T

Creates a new pool that can contain up to capacity entries as well as extra extra bytes. Initializes each entry with the given function.

fn checkout(&mut self) -> Option<Checkout<T>>

Checkout a value from the pool. Returns None if the pool is currently at capacity.

Trait Implementations

impl<T: Send> Send for Pool<T>