diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index d63af76b..5af51cd1 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs @@ -109,7 +109,10 @@ impl<'d, T: GpioPin> InputPin for ExtiInput<'d, T> { } impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { - type Future<'a> = ExtiInputFuture<'a>; + type Future<'a> + where + Self: 'a, + = ExtiInputFuture<'a>; fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> { ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, false) @@ -117,7 +120,10 @@ impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { } impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { - type Future<'a> = ExtiInputFuture<'a>; + type Future<'a> + where + Self: 'a, + = ExtiInputFuture<'a>; fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> { ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), false, true) @@ -125,7 +131,10 @@ impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { } impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> { - type Future<'a> = ExtiInputFuture<'a>; + type Future<'a> + where + Self: 'a, + = ExtiInputFuture<'a>; fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, true) diff --git a/embassy-traits/src/delay.rs b/embassy-traits/src/delay.rs index caa0b100..c4ef155e 100644 --- a/embassy-traits/src/delay.rs +++ b/embassy-traits/src/delay.rs @@ -1,7 +1,9 @@ use core::future::Future; pub trait Delay { - type DelayFuture<'a>: Future + 'a; + type DelayFuture<'a>: Future + 'a + where + Self: 'a; /// Future that completes after now + millis fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>; diff --git a/embassy-traits/src/gpio.rs b/embassy-traits/src/gpio.rs index b8f31fc6..3752c8d6 100644 --- a/embassy-traits/src/gpio.rs +++ b/embassy-traits/src/gpio.rs @@ -2,7 +2,9 @@ use core::future::Future; /// Wait for a pin to become high. pub trait WaitForHigh { - type Future<'a>: Future + 'a; + type Future<'a>: Future + 'a + where + Self: 'a; /// Wait for a pin to become high. /// @@ -13,7 +15,9 @@ pub trait WaitForHigh { /// Wait for a pin to become low. pub trait WaitForLow { - type Future<'a>: Future + 'a; + type Future<'a>: Future + 'a + where + Self: 'a; /// Wait for a pin to become low. /// @@ -24,7 +28,9 @@ pub trait WaitForLow { /// Wait for a rising edge (transition from low to high) pub trait WaitForRisingEdge { - type Future<'a>: Future + 'a; + type Future<'a>: Future + 'a + where + Self: 'a; /// Wait for a rising edge (transition from low to high) fn wait_for_rising_edge(&mut self) -> Self::Future<'_>; @@ -32,7 +38,9 @@ pub trait WaitForRisingEdge { /// Wait for a falling edge (transition from high to low) pub trait WaitForFallingEdge { - type Future<'a>: Future + 'a; + type Future<'a>: Future + 'a + where + Self: 'a; /// Wait for a falling edge (transition from high to low) fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>; @@ -40,7 +48,9 @@ pub trait WaitForFallingEdge { /// Wait for any edge (any transition, high to low or low to high) pub trait WaitForAnyEdge { - type Future<'a>: Future + 'a; + type Future<'a>: Future + 'a + where + Self: 'a; /// Wait for any edge (any transition, high to low or low to high) fn wait_for_any_edge(&mut self) -> Self::Future<'_>; diff --git a/embassy-traits/src/spi.rs b/embassy-traits/src/spi.rs index 04322ddd..14f79b05 100644 --- a/embassy-traits/src/spi.rs +++ b/embassy-traits/src/spi.rs @@ -27,7 +27,8 @@ pub trait Spi { pub trait FullDuplex: Spi + Write + Read { type WriteReadFuture<'a>: Future> + 'a where - Self: 'a; + Self: 'a, + Word: 'a; /// The `read` array must be at least as long as the `write` array, /// but is guaranteed to only be filled with bytes equal to the @@ -42,7 +43,8 @@ pub trait FullDuplex: Spi + Write + Read { pub trait Write: Spi { type WriteFuture<'a>: Future> + 'a where - Self: 'a; + Self: 'a, + Word: 'a; fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>; } @@ -50,7 +52,8 @@ pub trait Write: Spi { pub trait Read: Write { type ReadFuture<'a>: Future> + 'a where - Self: 'a; + Self: 'a, + Word: 'a; fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>; }