Skip to main content

bws_rs/
error.rs

1use std::fmt::{Debug, Display};
2
3pub enum Error{
4  Illegal,
5  UnSupport,
6  Other(String),
7}
8impl Display for Error{
9    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10      match self {
11        Self::Illegal => write!(f, "Illegal"),
12        Self::UnSupport => write!(f, "UnSupport"),
13        Self::Other(arg0) => f.debug_tuple("Other").field(arg0).finish(),
14    }
15    }
16}
17impl Debug for Error{
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        match self {
20            Self::Illegal => write!(f, "Illegal"),
21            Self::UnSupport => write!(f, "UnSupport"),
22            Self::Other(arg0) => f.debug_tuple("Other").field(arg0).finish(),
23        }
24    }
25}
26impl std::error::Error for Error{
27
28}