pub trait IntoDomainErrorKind {
// Required method
fn kind(&self) -> DomainErrorKind;
}Expand description
Implement this trait on your service’s domain error type to unlock the
generic domain_to_connect mapper.
§Example
use api_bones::connect::{DomainErrorKind, IntoDomainErrorKind};
enum MyError {
NotFound,
AlreadyExists(String),
Unexpected(String),
}
impl IntoDomainErrorKind for MyError {
fn kind(&self) -> DomainErrorKind {
match self {
Self::NotFound => DomainErrorKind::NotFound,
Self::AlreadyExists(msg) => DomainErrorKind::Conflict(msg.clone()),
Self::Unexpected(msg) => DomainErrorKind::Internal(msg.clone()),
}
}
}Required Methods§
fn kind(&self) -> DomainErrorKind
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".