Trait maskerad_object_pool::Recyclable
[−]
[src]
pub trait Recyclable { fn reinitialize(&mut self); }
If we want to create a pool of T
, T
must implement Recyclable
.
A pool item must have the following properties:
Be shareable. outside code ask the pool for an object, and the pool give them the first free handle it can find. Once those pool items are no longer used by outside code, they must go back in the pool automatically. This functionality is provided by the
RcHandle<T>
s andArcHandle<T>
s, returned by theRcPool<T>
s andArcPool<T>
s. Those types are reference counted smart pointers with interior mutability and a customDrop
implementation.Be recyclable. When a pool item is no longer used by outside code, the pool item must reinitialize its object to a given state. This functionality is provided by this trait.