Skip to main content

esp_idf_hal/
io.rs

1//! Error types
2
3use core::fmt::{self, Display, Formatter};
4
5pub use embedded_io::*;
6
7use crate::sys::EspError;
8
9#[derive(Copy, Clone, PartialEq, Eq, Debug)]
10pub struct EspIOError(pub EspError);
11
12impl Error for EspIOError {
13    fn kind(&self) -> ErrorKind {
14        ErrorKind::Other
15    }
16}
17
18impl From<EspError> for EspIOError {
19    fn from(e: EspError) -> Self {
20        Self(e)
21    }
22}
23
24impl Display for EspIOError {
25    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
26        self.0.fmt(f)
27    }
28}
29
30impl core::error::Error for EspIOError {}
31
32pub mod asynch {
33    pub use embedded_io_async::*;
34}