pub trait ResourceManager: Send + Sync {
type Resource;
type Config;
// Required methods
fn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn release<'life0, 'async_trait>(
&'life0 self,
resource: Self::Resource,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn configure(&mut self, config: Self::Config);
fn get_stats(&self) -> ResourceStats;
}
Expand description
Resource management interface
Required Associated Types§
Required Methods§
Sourcefn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Acquire a resource
Sourcefn release<'life0, 'async_trait>(
&'life0 self,
resource: Self::Resource,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release<'life0, 'async_trait>(
&'life0 self,
resource: Self::Resource,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Release a resource
Sourcefn get_stats(&self) -> ResourceStats
fn get_stats(&self) -> ResourceStats
Get resource statistics