openlegends-server 0.3.0

OpenLegends Game Server
Documentation
use std::{
    fmt::{Display, Formatter, Result},
    string::FromUtf8Error,
};

#[derive(Debug)]
pub enum Error {
    Header,
    Protocol,
    Route,
    Utf8(FromUtf8Error),
}

impl Display for Error {
    fn fmt(&self, f: &mut Formatter) -> Result {
        match self {
            Self::Header => write!(f, "Header error"),
            Self::Protocol => write!(f, "Protocol error"),
            Self::Route => write!(f, "Route error"),
            Self::Utf8(e) => write!(f, "UTF-8 error: `{e}`"),
        }
    }
}