Skip to content

Commit

Permalink
Use void since Infallible is only available on Rust >= 1.34.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Jun 19, 2020
1 parent ca044b8 commit bae6c23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ edition = "2018"
[dependencies]
embedded-hal = "=1.0.0-alpha.1"
nb = "0.1.1"
void = "1"
10 changes: 5 additions & 5 deletions src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! [`std::thread::sleep`](https://doc.rust-lang.org/std/thread/fn.sleep.html)
//! to implement the delay.

use core::convert::Infallible;
use void::Void;
use std::thread;
use std::time::Duration;

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

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

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

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

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

0 comments on commit bae6c23

Please sign in to comment.