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
42
43
44
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")
}
}
}
}