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
use std::fmt::{self, Display, Formatter};
pub type Result<T> = std::result::Result<T, OpError>;
#[derive(Debug)]
pub enum OpError {
NoSuchCrate(String),
CircularDependency(String, String),
}
impl Display for OpError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(
f,
"{}",
match self {
Self::NoSuchCrate(n) => format!("No crate `{}` was not found in the workspace", n),
Self::CircularDependency(a, b) => format!(
"Crates `{}` and `{}` share a hard circular dependency.\
Operation not possible!",
a, b
),
}
)
}
}