[][src]Struct remem::Pool

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

A pool of reusable memory.

Methods

impl<T> Pool<T>[src]

pub fn new<C>(create: C) -> Pool<T> where
    C: Fn() -> T + Send + Sync + 'static, 
[src]

Create a new Pool from an initializer function.

pub fn with_clear<C, D>(create: C, clear: D) -> Pool<T> where
    C: Fn() -> T + Send + Sync + 'static,
    D: Fn(&mut T) + Send + Sync + 'static, 
[src]

Create a new Pool from an initializer function and a clear function.

The clear function will be called whenever the ItemGuard is dropped, and provides an opportunity to clear values and remove potentially sensitive information from the items before returning it to the memory pool.

Note that drop in Rust is not guaranteed to run, so this function is not a replacement for proper security measures.

pub fn get<'a>(&'a self) -> ItemGuard<'a, T>[src]

Get an item from the pool.

Trait Implementations

impl<T> Clone for Pool<T>[src]

Auto Trait Implementations

impl<T> Send for Pool<T> where
    T: Send + Sync

impl<T> Sync for Pool<T> where
    T: Send + Sync

impl<T> Unpin for Pool<T>

impl<T> !UnwindSafe for Pool<T>

impl<T> !RefUnwindSafe for Pool<T>

Blanket Implementations

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

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