use nom::error::ErrorKind; use nom::error::ParseError; use nom::IResult; pub(crate) type Res = IResult>; // TODO: MyError probably shouldn't be based on the same type as the input type since it's used exclusively with static strings right now. #[derive(Debug)] pub enum CustomError { MyError(MyError), Nom(I, ErrorKind), IO(std::io::Error), } #[derive(Debug)] pub struct MyError(pub(crate) I); impl ParseError for CustomError { fn from_error_kind(input: I, kind: ErrorKind) -> Self { CustomError::Nom(input, kind) } fn append(_input: I, _kind: ErrorKind, /*mut*/ other: Self) -> Self { // Doesn't do append like VerboseError other } } impl From for CustomError { fn from(value: std::io::Error) -> Self { CustomError::IO(value) } }