mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Add comments (error_policy.rs)
This commit is contained in:
parent
174203e77f
commit
6ef2e96842
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@ use std::future::Future;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
|
/// Implementors of this trait are treated as error-handlers.
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait ErrorPolicy {
|
pub trait ErrorPolicy {
|
||||||
type Error;
|
type Error;
|
||||||
|
@ -9,6 +10,8 @@ pub trait ErrorPolicy {
|
||||||
async fn handle_error(&mut self, error: Self::Error);
|
async fn handle_error(&mut self, error: Self::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A convenient structure with an error-handling closure. Implements
|
||||||
|
/// `ErrorPolicy`.
|
||||||
pub struct FnErrorPolicy<F>(pub F);
|
pub struct FnErrorPolicy<F>(pub F);
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|
Loading…
Reference in a new issue