oneline_template/template/syntax/
unexpected_input_error.rs

1use std::error::Error;
2use std::fmt;
3
4/// Wrong input was passed.
5#[derive(Debug)]
6pub struct UnexpectedInputError {
7    input: String,
8}
9
10impl UnexpectedInputError {
11    pub (crate) fn new(input: impl Into<String>) -> UnexpectedInputError {
12        return UnexpectedInputError {
13            input: input.into(),
14        }
15    }
16}
17
18impl fmt::Display for UnexpectedInputError {
19    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20        write!(f, "Unexpected input `{}`", self.input)
21    }
22}
23
24impl Error for UnexpectedInputError {}