-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hal-async: fix warnings for latest nightly (1.75.0)
Fixes `cargo check` warnings for the latest nightly version (`1.75.0`). Recommended public API signatures for async trait functions has changed to recommending the desugared version for compatibility with different `async` runtimes.
- Loading branch information
Showing
4 changed files
with
142 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
//! Delays. | ||
|
||
use core::future::Future; | ||
|
||
/// Microsecond delay. | ||
pub trait DelayUs { | ||
/// Pauses execution for at minimum `us` microseconds. Pause can be longer | ||
/// if the implementation requires it due to precision/timing issues. | ||
async fn delay_us(&mut self, us: u32); | ||
fn delay_us(&mut self, us: u32) -> impl Future<Output = ()>; | ||
|
||
/// Pauses execution for at minimum `ms` milliseconds. Pause can be longer | ||
/// if the implementation requires it due to precision/timing issues. | ||
async fn delay_ms(&mut self, ms: u32); | ||
fn delay_ms(&mut self, ms: u32) -> impl Future<Output = ()>; | ||
} | ||
|
||
impl<T> DelayUs for &mut T | ||
where | ||
T: DelayUs + ?Sized, | ||
{ | ||
#[inline] | ||
async fn delay_us(&mut self, us: u32) { | ||
T::delay_us(self, us).await; | ||
fn delay_us(&mut self, us: u32) -> impl Future<Output = ()> { | ||
async move { | ||
T::delay_us(self, us).await; | ||
} | ||
} | ||
|
||
#[inline] | ||
async fn delay_ms(&mut self, ms: u32) { | ||
T::delay_ms(self, ms).await; | ||
fn delay_ms(&mut self, ms: u32) -> impl Future<Output = ()> { | ||
async move { | ||
T::delay_ms(self, ms).await; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.