use std::{
error::Error,
fmt::{Debug, Display},
};
#[non_exhaustive]
#[derive(Debug)]
pub enum BindError {
ServiceBound(&'static str),
}
impl Error for BindError {}
impl Display for BindError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ServiceBound(service) => {
write!(f, "service `{service}` is already bound to a provider")
}
}
}
}
#[non_exhaustive]
#[derive(Debug)]
pub enum UnbindError {
ServiceUnbound(&'static str),
}
impl Error for UnbindError {}
impl Display for UnbindError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
UnbindError::ServiceUnbound(service) => {
write!(f, "service `{service}` is not bound to a provider")
}
}
}
}