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