Read the setup file into memory.

This commit is contained in:
Tom Alexander
2023-09-04 16:53:02 -04:00
parent a7330e38e4
commit ee02e07717
4 changed files with 19 additions and 5 deletions

View File

@@ -5,13 +5,14 @@ use nom::IResult;
pub type Res<T, U> = IResult<T, U, CustomError<T>>;
// 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, PartialEq)]
#[derive(Debug)]
pub enum CustomError<I> {
MyError(MyError<I>),
Nom(I, ErrorKind),
IO(std::io::Error),
}
#[derive(Debug, PartialEq)]
#[derive(Debug)]
pub struct MyError<I>(pub I);
impl<I> ParseError<I> for CustomError<I> {
@@ -24,3 +25,9 @@ impl<I> ParseError<I> for CustomError<I> {
other
}
}
impl<I> From<std::io::Error> for CustomError<I> {
fn from(value: std::io::Error) -> Self {
CustomError::IO(value)
}
}