witx_codegen/
error.rs

1use std::fmt;
2
3use witx::WitxError;
4
5#[derive(Debug)]
6pub enum Error {
7    Witx(WitxError),
8    Io(std::io::Error),
9}
10
11impl fmt::Display for Error {
12    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13        write!(f, "{:?}", &self)
14    }
15}
16
17impl std::error::Error for Error {
18    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
19        None
20    }
21}
22
23impl From<std::io::Error> for Error {
24    fn from(e: std::io::Error) -> Self {
25        Error::Io(e)
26    }
27}
28
29impl From<WitxError> for Error {
30    fn from(e: WitxError) -> Self {
31        Self::Witx(e)
32    }
33}