Debian Codegraph @

src/errors.rs

raw symbols SCIP
1 //! Error handling.
2
3 /// Library errors.
4 #[derive(Debug)]
5 pub struct CapsError(pub(crate) String);
6
7 impl From<&str> for CapsError {
8 fn from(arg: &str) -> Self {
9 Self(arg.to_string())
10 }
11 }
12
13 impl From<String> for CapsError {
14 fn from(arg: String) -> Self {
15 Self(arg)
16 }
17 }
18
19 impl std::error::Error for CapsError {}
20
21 impl std::fmt::Display for CapsError {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 write!(f, "caps error: {}", self.0)
24 }
25 }