1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#[derive(Debug)]
pub enum ErrorType {
ClosingTagMismatch,
NotFound(&'static str),
UnexpectedEnd,
}
impl ErrorType {
pub fn message(self) -> String {
match self {
ErrorType::ClosingTagMismatch => {
format!("Closing tag name does not match opening tag.")
}
ErrorType::NotFound(exp) => {
format!("Expected {}.", exp)
}
ErrorType::UnexpectedEnd => {
format!("Unexpected end of source code.")
}
}
}
}
pub type ProcessingResult<T> = Result<T, ErrorType>;