pub trait RecoveryStrategy: Send + Sync {
// Required methods
fn can_recover<'life0, 'life1, 'async_trait>(
&'life0 self,
error: &'life1 AiLibError,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn recover<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 AiLibError,
context: &'life2 ErrorContext,
) -> Pin<Box<dyn Future<Output = Result<(), AiLibError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
Trait for implementing recovery strategies
Required Methods§
Sourcefn can_recover<'life0, 'life1, 'async_trait>(
&'life0 self,
error: &'life1 AiLibError,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn can_recover<'life0, 'life1, 'async_trait>(
&'life0 self,
error: &'life1 AiLibError,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if this strategy can recover from the given error
Sourcefn recover<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 AiLibError,
context: &'life2 ErrorContext,
) -> Pin<Box<dyn Future<Output = Result<(), AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn recover<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 AiLibError,
context: &'life2 ErrorContext,
) -> Pin<Box<dyn Future<Output = Result<(), AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Attempt to recover from the error