Skip to content

Commit a0bd3dc

Browse files
bors[bot]jannic
andauthored
Merge #328
328: Implement Error traits for Infallible r=ryankurte a=jannic Co-authored-by: Jan Niehusmann <[email protected]>
2 parents 58777c2 + 93f2bc4 commit a0bd3dc

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
- `Error` traits for Can, SPI, I2C and Serial are implemented for Infallible
1012

1113
## [v1.0.0-alpha.6] - 2021-11-19
1214

src/can/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ pub trait Error: core::fmt::Debug {
5858
fn kind(&self) -> ErrorKind;
5959
}
6060

61+
impl Error for core::convert::Infallible {
62+
fn kind(&self) -> ErrorKind {
63+
match *self {}
64+
}
65+
}
66+
6167
/// CAN error kind
6268
///
6369
/// This represents a common set of CAN operation errors. HAL implementations are

src/i2c.rs

+6
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ pub trait Error: core::fmt::Debug {
107107
fn kind(&self) -> ErrorKind;
108108
}
109109

110+
impl Error for core::convert::Infallible {
111+
fn kind(&self) -> ErrorKind {
112+
match *self {}
113+
}
114+
}
115+
110116
/// I2C error kind
111117
///
112118
/// This represents a common set of I2C operation errors. HAL implementations are

src/serial/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ pub trait Error: core::fmt::Debug {
1313
fn kind(&self) -> ErrorKind;
1414
}
1515

16+
impl Error for core::convert::Infallible {
17+
fn kind(&self) -> ErrorKind {
18+
match *self {}
19+
}
20+
}
21+
1622
/// Serial error kind
1723
///
1824
/// This represents a common set of serial operation errors. HAL implementations are

src/spi/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ pub trait Error: core::fmt::Debug {
6464
fn kind(&self) -> ErrorKind;
6565
}
6666

67+
impl Error for core::convert::Infallible {
68+
fn kind(&self) -> ErrorKind {
69+
match *self {}
70+
}
71+
}
72+
6773
/// SPI error kind
6874
///
6975
/// This represents a common set of SPI operation errors. HAL implementations are

0 commit comments

Comments
 (0)