Struct poison_pool::PoisonPool [] [src]

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

A pool that contains elements that can be recycled when they are finished being used.

Methods

impl<T> PoisonPool<T>

fn new<F: FnMut() -> T>(count: usize, init: F) -> PoisonPool<T>

Creates a new PoisonPool with a given size and where each element is initialized by the init function.

fn get(&self) -> Option<Item<T>>

Returns an unpoisoned item from the pool if possible.

fn get_or(&self, v: T) -> Item<T>

Returns an unpoisoned item from the pool, or a given value, if one is not available.

fn get_or_else<F: FnOnce() -> T>(&self, f: F) -> Item<T>

Returns an unpoisoned item from the pool, or value generated by the function f if one is not available

fn unpoison_all(&self)

Removes poison from all the internal items

Trait Implementations

Derived Implementations

impl<T: Clone> Clone for PoisonPool<T> where T: Clone

fn clone(&self) -> PoisonPool<T>

fn clone_from(&mut self, source: &Self)