explicit_error/domain.rs
1/// This trait must be implemented for type that converts to [Error](crate::Error)
2/// Example of such implementation can be found in crates `explicit-error-http` or `explicit-error-exit` for `DomainError`.
3pub trait Domain
4where
5 Self: std::error::Error
6 + 'static
7 + std::fmt::Debug
8 + Into<crate::error::Error<Self>>
9 + Send
10 + Sync,
11{
12 fn with_context(self, context: impl std::fmt::Display) -> Self;
13
14 fn context(&self) -> Option<&str>;
15
16 fn into_source(self) -> Option<Box<dyn std::error::Error + Send + Sync>>;
17}