embedded_sensors/mpu6500/
result.rs1use core::fmt;
2
3pub type Result<T, I2cError> = core::result::Result<T, Error<I2cError>>;
4
5#[derive(Debug)]
6pub enum Error<I2cError> {
7 InvalidDevice(u8),
8 I2cError(I2cError),
9}
10
11impl<I2cError> fmt::Display for Error<I2cError>
12where
13 I2cError: fmt::Debug,
14{
15 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16 use Error::*;
17
18 match &self {
19 InvalidDevice(v) => write!(f, "Invalid device with id {}", v),
20 I2cError(e) => fmt::Debug::fmt(&e, f),
21 }
22 }
23}