[−][src]Struct remem::Pool
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]
C: Fn() -> T + Send + Sync + 'static,
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]
C: Fn() -> T + Send + Sync + 'static,
D: Fn(&mut T) + Send + Sync + 'static,
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]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<T> Send for Pool<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Sync for Pool<T> where
T: Send + Sync,
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,