Poolable

Trait Poolable 

Source
pub trait Poolable {
    // Required methods
    fn empty() -> Self;
    fn reset(&mut self);
    fn capacity(&self) -> usize;

    // Provided method
    fn really_dropped(&mut self) -> bool { ... }
}
Expand description

Trait for poolable objects

Required Methods§

Source

fn empty() -> Self

allocate a new empty collection

Source

fn reset(&mut self)

empty the collection and reset it to it’s default state so it can be put back in the pool.

Source

fn capacity(&self) -> usize

return the capacity of the collection

Provided Methods§

Source

fn really_dropped(&mut self) -> bool

return true if the object has really been dropped, e.g. if you’re pooling an Arc then Arc::get_mut().is_some() == true.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Poolable for String

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<K, R> Poolable for HashSet<K, R>
where K: Hash + Eq, R: Default + BuildHasher,

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<K, R> Poolable for IndexSet<K, R>
where K: Hash + Eq, R: Default + BuildHasher,

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<K, V, R> Poolable for HashMap<K, V, R>
where K: Hash + Eq, R: Default + BuildHasher,

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<K, V, R> Poolable for IndexMap<K, V, R>
where K: Hash + Eq, R: Default + BuildHasher,

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<T> Poolable for VecDeque<T>

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<T> Poolable for Vec<T>

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

impl<T: Poolable> Poolable for Option<T>

Source§

fn empty() -> Self

Source§

fn reset(&mut self)

Source§

fn capacity(&self) -> usize

Source§

fn really_dropped(&mut self) -> bool

Implementors§