From d336a4b38a3e5cef1337f39c657beab76b60640e Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 14 Apr 2021 16:39:08 +0200 Subject: [PATCH] Remove Pin from Delay trait --- embassy-traits/src/delay.rs | 5 ++--- embassy/src/executor/timer.rs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/embassy-traits/src/delay.rs b/embassy-traits/src/delay.rs index 1e763350b..31239d319 100644 --- a/embassy-traits/src/delay.rs +++ b/embassy-traits/src/delay.rs @@ -1,12 +1,11 @@ use core::future::Future; -use core::pin::Pin; pub trait Delay { type DelayFuture<'a>: Future + '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>; } diff --git a/embassy/src/executor/timer.rs b/embassy/src/executor/timer.rs index 8297564a0..d66c7cae5 100644 --- a/embassy/src/executor/timer.rs +++ b/embassy/src/executor/timer.rs @@ -23,10 +23,10 @@ impl Delay { impl crate::traits::delay::Delay for Delay { type DelayFuture<'a> = impl Future + '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)) } }