#[derive(Debug, PartialEq, Eq)]
pub enum ProtocolError {
Malformed(&'static str),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CmdError {
Wire(&'static str),
}
impl CmdError {
pub fn as_wire(self) -> &'static str {
match self {
Self::Wire(s) => s,
}
}
}
impl std::fmt::Display for CmdError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_wire())
}
}
impl std::error::Error for CmdError {}
impl From<&'static str> for CmdError {
fn from(s: &'static str) -> Self {
Self::Wire(s)
}
}