mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-12 22:56:41 +01:00
20 lines
541 B
Rust
20 lines
541 B
Rust
use crate::*;
|
|
|
|
#[derive(Debug)]
|
|
pub enum ParseError {
|
|
Unknown(u8),
|
|
Empty,
|
|
Incomplete,
|
|
Unexpected(char),
|
|
}
|
|
impl std::fmt::Display for ParseError {
|
|
fn fmt (&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
match self {
|
|
Self::Empty => write!(f, "empty"),
|
|
Self::Incomplete => write!(f, "incomplete"),
|
|
Self::Unexpected(c) => write!(f, "unexpected '{c}'"),
|
|
Self::Unknown(i) => write!(f, "unknown #{i}"),
|
|
}
|
|
}
|
|
}
|
|
impl std::error::Error for ParseError {}
|