Implement std::fmt::Display for parser errors

This commit is contained in:
cdo committed 2026-09-26 10:40:19 +01:00
1 parent c2cab32c58
commit a756756a9f
1 file changed
+9
+9
View File
@@ -9,6 +9,15 @@ pub enum Error {
InvalidSyntax, 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 { impl std::str::FromStr for Expression {
type Err = Error; type Err = Error;