1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use std::fmt::{Debug, Formatter, Result};

#[derive(Copy, Clone, Eq, PartialEq)]
pub enum ParseErrKind {
    BeginWithIllegalChar,
    IllegalCharEncounter,
}

impl Debug for ParseErrKind {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        match self {
            ParseErrKind::BeginWithIllegalChar => {
                write!(f, "{}", "The string to be parsed begin with an illegal character")
            },
            ParseErrKind::IllegalCharEncounter => {
                write!(f, "{}", "Illegal character encountered during parsing")
            }
        }
    }
}