pub trait Manager {
type Type;
type Error;
fn create<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Type, Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn recycle<'life0, 'life1, 'async_trait>(
&'life0 self,
obj: &'life1 mut Self::Type
) -> Pin<Box<dyn Future<Output = RecycleResult<Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn detach(&self, _obj: &mut Self::Type) { ... }
}
Expand description
This trait is used to create
new objects or recycle
existing ones.
Required Associated Types
Required Methods
Create a new instance of Type
Try to recycle an instance of Type
returning an Error
if the
object could not be recycled.
Provided Methods
Detach an instance of Type
from this manager. This method is
called when using the Object::take
function for removing
an object from the pool. If the manager doesn’t hold any
references to the handed out objects the default implementation
can be used which does nothing.