Add comments (error_policy.rs)

This commit is contained in:
Temirkhan Myrzamadi 2019-10-31 15:50:36 +06:00
parent 174203e77f
commit 6ef2e96842

View file

@ -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]