1use std::fmt;
6
7#[derive(Debug)]
9pub enum Error {
10 Io(std::io::Error),
12 Read(combine::stream::read::Error),
14 Parse(combine::error::UnexpectedParse),
16}
17
18impl From<std::io::Error> for Error {
19 fn from(err: std::io::Error) -> Self {
20 Error::Io(err)
21 }
22}
23
24impl From<combine::stream::read::Error> for Error {
25 fn from(err: combine::stream::read::Error) -> Self {
26 Error::Read(err)
27 }
28}
29
30impl From<combine::error::UnexpectedParse> for Error {
31 fn from(err: combine::error::UnexpectedParse) -> Self {
32 Error::Parse(err)
33 }
34}
35
36impl fmt::Display for Error {
37 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38 match self {
39 Error::Io(err) => write!(f, "{err}"),
40 Error::Read(err) => write!(f, "{err}"),
41 Error::Parse(err) => write!(f, "{err}"),
42 }
43 }
44}
45
46impl std::error::Error for Error {}