Trait deadpool::managed::Manager[][src]

pub trait Manager {
    type Type;
    type Error;
    #[must_use]
    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
;
#[must_use] 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.

Associated Types

type Type[src]

Type that the manager creates and recycles.

type Error[src]

The error that the manager can return when creating and recycling objects.

Required methods

#[must_use]
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, 
[src]

Create a new instance of Type

#[must_use]
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, 
[src]

Try to recycle an instance of Type returning an Error if the object could not be recycled.

Provided methods

fn detach(&self, _obj: &mut Self::Type)[src]

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.

Implementors