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
use core::fmt::Display;
pub type Result<T, E = Error> = ::core::result::Result<T, E>;
#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
pub enum Error {
#[error("Diff Error: {0}")]
DiffError(String),
#[error("Merge Error: {0}")]
MergeError(String),
#[error("Conversion Error: {0}")]
ConversionError(String),
}
impl Error {
pub fn diff<T>(message: T) -> Self
where
T: Display,
{
Self::DiffError(format!("{}", message))
}
pub fn merge<T>(message: T) -> Self
where
T: Display,
{
Self::MergeError(format!("{}", message))
}
pub fn convert<T>(message: T) -> Self
where
T: Display,
{
Self::ConversionError(format!("{}", message))
}
}