use std::fmt;
use std::fmt::Display;
use serde::{de, ser};
#[derive(Debug)]
pub enum Error {
Message(String),
}
impl de::Error for Error {
fn custom<T: Display>(msg: T) -> Self {
Error::Message(msg.to_string())
}
}
impl ser::Error for Error {
fn custom<T: Display>(msg: T) -> Self {
Error::Message(msg.to_string())
}
}
impl Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::Message(msg) => write!(f, "{}", msg),
}
}
}
impl std::error::Error for Error {}