1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::register::RegisterError;
pub mod builder;
mod std_;
#[cfg(feature = "tokio")]
mod tokio;
pub use builder::Builder;
#[derive(Debug)]
pub struct Handler {
builder: Builder,
}
impl Handler {
pub fn builder() -> Builder {
Builder::new()
}
pub(crate) fn from_builder(builder: Builder) -> Self {
Self { builder }
}
}
#[derive(Debug)]
pub enum HandleError {
AsyncRequired,
RegisterFailed(RegisterError),
Other(Box<dyn std::error::Error + Send + Sync + 'static>),
}
impl core::fmt::Display for HandleError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{:?}", self)
}
}
impl std::error::Error for HandleError {}