use std::future::Future;
use crate::managed::{Metrics, RecycleError};
pub trait Manager: Sync + Send {
type Type: Send;
type Error: Send;
fn create(&self) -> impl Future<Output = Result<Self::Type, Self::Error>> + Send;
fn recycle(
&self,
obj: &mut Self::Type,
metrics: &Metrics,
) -> impl Future<Output = RecycleResult<Self::Error>> + Send;
fn detach(&self, _obj: &mut Self::Type) {}
}
pub type RecycleResult<E> = Result<(), RecycleError<E>>;