Revision control
Copy as Markdown
Other Tools
use std::error::Error;
use std::fmt::{self, Display};
#[derive(Debug, PartialEq)]
pub enum ParserError {
InvalidLanguage,
InvalidSubtag,
}
impl Error for ParserError {}
impl Display for ParserError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let value = match self {
ParserError::InvalidLanguage => "The given language subtag is invalid",
ParserError::InvalidSubtag => "Invalid subtag",
};
f.write_str(value)
}
}