diff options
| author | Wilfried Chauveau <[email protected]> | 2021-11-21 08:11:00 +0000 |
|---|---|---|
| committer | Wilfried Chauveau <[email protected]> | 2021-11-21 10:10:28 +0000 |
| commit | eac604accd27fc2a32aeb2e1b1256c4b9ef52951 (patch) | |
| tree | 1cbdf02707f02fc3946422295586ac58bd2f81c0 | |
| parent | 8d108d875394a08d6cb42d06a9c55a4c8e0833ac (diff) | |
Fix missing lifetime bounds
| -rw-r--r-- | embassy-stm32/src/exti.rs | 15 | ||||
| -rw-r--r-- | embassy-traits/src/delay.rs | 4 | ||||
| -rw-r--r-- | embassy-traits/src/gpio.rs | 20 | ||||
| -rw-r--r-- | embassy-traits/src/spi.rs | 9 |
4 files changed, 36 insertions, 12 deletions
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index d63af76be..5af51cd11 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> { | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { | 111 | impl<'d, T: GpioPin> WaitForRisingEdge for ExtiInput<'d, T> { |
| 112 | type Future<'a> = ExtiInputFuture<'a>; | 112 | type Future<'a> |
| 113 | where | ||
| 114 | Self: 'a, | ||
| 115 | = ExtiInputFuture<'a>; | ||
| 113 | 116 | ||
| 114 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> { | 117 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 115 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, false) | 118 | 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> { | |||
| 117 | } | 120 | } |
| 118 | 121 | ||
| 119 | impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { | 122 | impl<'d, T: GpioPin> WaitForFallingEdge for ExtiInput<'d, T> { |
| 120 | type Future<'a> = ExtiInputFuture<'a>; | 123 | type Future<'a> |
| 124 | where | ||
| 125 | Self: 'a, | ||
| 126 | = ExtiInputFuture<'a>; | ||
| 121 | 127 | ||
| 122 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> { | 128 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 123 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), false, true) | 129 | 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> { | |||
| 125 | } | 131 | } |
| 126 | 132 | ||
| 127 | impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> { | 133 | impl<'d, T: GpioPin> WaitForAnyEdge for ExtiInput<'d, T> { |
| 128 | type Future<'a> = ExtiInputFuture<'a>; | 134 | type Future<'a> |
| 135 | where | ||
| 136 | Self: 'a, | ||
| 137 | = ExtiInputFuture<'a>; | ||
| 129 | 138 | ||
| 130 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { | 139 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { |
| 131 | ExtiInputFuture::new(self.pin.pin.pin(), self.pin.pin.port(), true, true) | 140 | 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 caa0b100a..c4ef155ee 100644 --- a/embassy-traits/src/delay.rs +++ b/embassy-traits/src/delay.rs | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | use core::future::Future; | 1 | use core::future::Future; |
| 2 | 2 | ||
| 3 | pub trait Delay { | 3 | pub trait Delay { |
| 4 | type DelayFuture<'a>: Future<Output = ()> + 'a; | 4 | type DelayFuture<'a>: Future<Output = ()> + 'a |
| 5 | where | ||
| 6 | Self: 'a; | ||
| 5 | 7 | ||
| 6 | /// Future that completes after now + millis | 8 | /// Future that completes after now + millis |
| 7 | fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>; | 9 | fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>; |
diff --git a/embassy-traits/src/gpio.rs b/embassy-traits/src/gpio.rs index b8f31fc6c..3752c8d60 100644 --- a/embassy-traits/src/gpio.rs +++ b/embassy-traits/src/gpio.rs | |||
| @@ -2,7 +2,9 @@ use core::future::Future; | |||
| 2 | 2 | ||
| 3 | /// Wait for a pin to become high. | 3 | /// Wait for a pin to become high. |
| 4 | pub trait WaitForHigh { | 4 | pub trait WaitForHigh { |
| 5 | type Future<'a>: Future<Output = ()> + 'a; | 5 | type Future<'a>: Future<Output = ()> + 'a |
| 6 | where | ||
| 7 | Self: 'a; | ||
| 6 | 8 | ||
| 7 | /// Wait for a pin to become high. | 9 | /// Wait for a pin to become high. |
| 8 | /// | 10 | /// |
| @@ -13,7 +15,9 @@ pub trait WaitForHigh { | |||
| 13 | 15 | ||
| 14 | /// Wait for a pin to become low. | 16 | /// Wait for a pin to become low. |
| 15 | pub trait WaitForLow { | 17 | pub trait WaitForLow { |
| 16 | type Future<'a>: Future<Output = ()> + 'a; | 18 | type Future<'a>: Future<Output = ()> + 'a |
| 19 | where | ||
| 20 | Self: 'a; | ||
| 17 | 21 | ||
| 18 | /// Wait for a pin to become low. | 22 | /// Wait for a pin to become low. |
| 19 | /// | 23 | /// |
| @@ -24,7 +28,9 @@ pub trait WaitForLow { | |||
| 24 | 28 | ||
| 25 | /// Wait for a rising edge (transition from low to high) | 29 | /// Wait for a rising edge (transition from low to high) |
| 26 | pub trait WaitForRisingEdge { | 30 | pub trait WaitForRisingEdge { |
| 27 | type Future<'a>: Future<Output = ()> + 'a; | 31 | type Future<'a>: Future<Output = ()> + 'a |
| 32 | where | ||
| 33 | Self: 'a; | ||
| 28 | 34 | ||
| 29 | /// Wait for a rising edge (transition from low to high) | 35 | /// Wait for a rising edge (transition from low to high) |
| 30 | fn wait_for_rising_edge(&mut self) -> Self::Future<'_>; | 36 | fn wait_for_rising_edge(&mut self) -> Self::Future<'_>; |
| @@ -32,7 +38,9 @@ pub trait WaitForRisingEdge { | |||
| 32 | 38 | ||
| 33 | /// Wait for a falling edge (transition from high to low) | 39 | /// Wait for a falling edge (transition from high to low) |
| 34 | pub trait WaitForFallingEdge { | 40 | pub trait WaitForFallingEdge { |
| 35 | type Future<'a>: Future<Output = ()> + 'a; | 41 | type Future<'a>: Future<Output = ()> + 'a |
| 42 | where | ||
| 43 | Self: 'a; | ||
| 36 | 44 | ||
| 37 | /// Wait for a falling edge (transition from high to low) | 45 | /// Wait for a falling edge (transition from high to low) |
| 38 | fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>; | 46 | fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>; |
| @@ -40,7 +48,9 @@ pub trait WaitForFallingEdge { | |||
| 40 | 48 | ||
| 41 | /// Wait for any edge (any transition, high to low or low to high) | 49 | /// Wait for any edge (any transition, high to low or low to high) |
| 42 | pub trait WaitForAnyEdge { | 50 | pub trait WaitForAnyEdge { |
| 43 | type Future<'a>: Future<Output = ()> + 'a; | 51 | type Future<'a>: Future<Output = ()> + 'a |
| 52 | where | ||
| 53 | Self: 'a; | ||
| 44 | 54 | ||
| 45 | /// Wait for any edge (any transition, high to low or low to high) | 55 | /// Wait for any edge (any transition, high to low or low to high) |
| 46 | fn wait_for_any_edge(&mut self) -> Self::Future<'_>; | 56 | fn wait_for_any_edge(&mut self) -> Self::Future<'_>; |
diff --git a/embassy-traits/src/spi.rs b/embassy-traits/src/spi.rs index 04322dddc..14f79b059 100644 --- a/embassy-traits/src/spi.rs +++ b/embassy-traits/src/spi.rs | |||
| @@ -27,7 +27,8 @@ pub trait Spi<Word> { | |||
| 27 | pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> { | 27 | pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> { |
| 28 | type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a | 28 | type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a |
| 29 | where | 29 | where |
| 30 | Self: 'a; | 30 | Self: 'a, |
| 31 | Word: 'a; | ||
| 31 | 32 | ||
| 32 | /// The `read` array must be at least as long as the `write` array, | 33 | /// The `read` array must be at least as long as the `write` array, |
| 33 | /// but is guaranteed to only be filled with bytes equal to the | 34 | /// but is guaranteed to only be filled with bytes equal to the |
| @@ -42,7 +43,8 @@ pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> { | |||
| 42 | pub trait Write<Word>: Spi<Word> { | 43 | pub trait Write<Word>: Spi<Word> { |
| 43 | type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a | 44 | type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a |
| 44 | where | 45 | where |
| 45 | Self: 'a; | 46 | Self: 'a, |
| 47 | Word: 'a; | ||
| 46 | 48 | ||
| 47 | fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>; | 49 | fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>; |
| 48 | } | 50 | } |
| @@ -50,7 +52,8 @@ pub trait Write<Word>: Spi<Word> { | |||
| 50 | pub trait Read<Word>: Write<Word> { | 52 | pub trait Read<Word>: Write<Word> { |
| 51 | type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a | 53 | type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a |
| 52 | where | 54 | where |
| 53 | Self: 'a; | 55 | Self: 'a, |
| 56 | Word: 'a; | ||
| 54 | 57 | ||
| 55 | fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>; | 58 | fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>; |
| 56 | } | 59 | } |
