Implement std::fmt::Display for parser errors
This commit is contained in:
1 parent
c2cab32c58
commit
a756756a9f
1 file changed
+9
@@ -9,6 +9,15 @@ pub enum Error {
|
||||
InvalidSyntax,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Error::Io(err) => write!(f, "I/O Error: {}", err),
|
||||
Error::InvalidSyntax => write!(f, "Invalid syntax"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for Expression {
|
||||
type Err = Error;
|
||||
|
||||
|
||||
Reference in new issue
Block a user