fungus/errors/
string_error.rs1use std::{error::Error as StdError, fmt};
2
3#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum StringError {
6 FailedToString,
8}
9
10impl StdError for StringError {}
11
12impl fmt::Display for StringError {
13 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
14 match *self {
15 StringError::FailedToString => write!(f, "failed to convert value to string"),
16 }
17 }
18}
19
20#[cfg(test)]
21mod tests {
22 use crate::errors::*;
23
24 #[test]
25 fn test_errors() {
26 assert_eq!(format!("{}", StringError::FailedToString), "failed to convert value to string");
27 }
28}