Skip to content

Commit bae6c23

Browse files
committed
Use void since Infallible is only available on Rust >= 1.34.0
1 parent ca044b8 commit bae6c23

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ edition = "2018"
2222
[dependencies]
2323
embedded-hal = "=1.0.0-alpha.1"
2424
nb = "0.1.1"
25+
void = "1"

src/delay.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! [`std::thread::sleep`](https://doc.rust-lang.org/std/thread/fn.sleep.html)
1313
//! to implement the delay.
1414
15-
use core::convert::Infallible;
15+
use void::Void;
1616
use std::thread;
1717
use std::time::Duration;
1818

@@ -31,7 +31,7 @@ impl MockNoop {
3131
macro_rules! impl_noop_delay_us {
3232
($type:ty) => {
3333
impl delay::DelayUs<$type> for MockNoop {
34-
type Error = Infallible;
34+
type Error = Void;
3535

3636
/// A no-op delay implementation.
3737
fn try_delay_us(&mut self, _n: $type) -> Result<(), Self::Error> {
@@ -49,7 +49,7 @@ impl_noop_delay_us!(u64);
4949
macro_rules! impl_noop_delay_ms {
5050
($type:ty) => {
5151
impl delay::DelayMs<$type> for MockNoop {
52-
type Error = Infallible;
52+
type Error = Void;
5353

5454
/// A no-op delay implementation.
5555
fn try_delay_ms(&mut self, _n: $type) -> Result<(), Self::Error> {
@@ -77,7 +77,7 @@ impl StdSleep {
7777
macro_rules! impl_stdsleep_delay_us {
7878
($type:ty) => {
7979
impl delay::DelayUs<$type> for StdSleep {
80-
type Error = Infallible;
80+
type Error = Void;
8181

8282
/// A `Delay` implementation that uses `std::thread::sleep`.
8383
fn try_delay_us(&mut self, n: $type) -> Result<(), Self::Error> {
@@ -96,7 +96,7 @@ impl_stdsleep_delay_us!(u64);
9696
macro_rules! impl_stdsleep_delay_ms {
9797
($type:ty) => {
9898
impl delay::DelayMs<$type> for StdSleep {
99-
type Error = Infallible;
99+
type Error = Void;
100100

101101
/// A `Delay` implementation that uses `std::thread::sleep`.
102102
fn try_delay_ms(&mut self, n: $type) -> Result<(), Self::Error> {

0 commit comments

Comments
 (0)