mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Remove Pin from Delay trait
This commit is contained in:
parent
f292647066
commit
d336a4b38a
@ -1,12 +1,11 @@
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
|
||||
pub trait Delay {
|
||||
type DelayFuture<'a>: Future<Output = ()> + 'a;
|
||||
|
||||
/// Future that completes after now + millis
|
||||
fn delay_ms<'a>(self: Pin<&'a mut Self>, millis: u64) -> Self::DelayFuture<'a>;
|
||||
fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a>;
|
||||
|
||||
/// Future that completes after now + micros
|
||||
fn delay_us<'a>(self: Pin<&'a mut Self>, micros: u64) -> Self::DelayFuture<'a>;
|
||||
fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a>;
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ impl Delay {
|
||||
impl crate::traits::delay::Delay for Delay {
|
||||
type DelayFuture<'a> = impl Future<Output = ()> + 'a;
|
||||
|
||||
fn delay_ms<'a>(self: Pin<&'a mut Self>, millis: u64) -> Self::DelayFuture<'a> {
|
||||
fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a> {
|
||||
Timer::after(Duration::from_millis(millis))
|
||||
}
|
||||
fn delay_us<'a>(self: Pin<&'a mut Self>, micros: u64) -> Self::DelayFuture<'a> {
|
||||
fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a> {
|
||||
Timer::after(Duration::from_micros(micros))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user