You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
815 B
28 lines
815 B
use std::fmt::{self, Display, Formatter};
|
|
|
|
/// Special result type that wraps an OpError
|
|
pub type Result<T> = std::result::Result<T, OpError>;
|
|
|
|
/// An error that occured while running an operation
|
|
#[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
|
|
),
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|