no_error_type/
lib.rs

1#![no_std]
2
3use core::{error::Error, fmt::Display};
4#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
5pub enum NoError {}
6impl Display for NoError {
7    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
8        match *self {}
9    }
10}
11impl Error for NoError {}
12#[cfg(feature = "embedded-io")]
13impl embedded_io::Error for NoError {
14    fn kind(&self) -> embedded_io::ErrorKind {
15        match *self {}
16    }
17}
18#[cfg(feature = "embedded-hal")]
19const _: () = {
20    impl embedded_hal::digital::Error for NoError {
21        fn kind(&self) -> embedded_hal::digital::ErrorKind {
22            match *self {}
23        }
24    }
25    impl embedded_hal::i2c::Error for NoError {
26        fn kind(&self) -> embedded_hal::i2c::ErrorKind {
27            match *self {}
28        }
29    }
30    impl embedded_hal::pwm::Error for NoError {
31        fn kind(&self) -> embedded_hal::pwm::ErrorKind {
32            match *self {}
33        }
34    }
35    impl embedded_hal::spi::Error for NoError {
36        fn kind(&self) -> embedded_hal::spi::ErrorKind {
37            match *self {}
38        }
39    }
40};