495: Fix missing lifetime bounds r=lulf a=ithinuel



Co-authored-by: Wilfried Chauveau <wilfried.chauveau@ithinuel.me>
This commit is contained in:
bors[bot] 2021-11-21 11:10:44 +00:00 committed by GitHub
commit 920bb3690e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 15 deletions

View File

@ -338,7 +338,10 @@ impl<'d, T: GpioPin> InputPin for PortInput<'d, T> {
}
impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> {
type Future<'a> = PortInputFuture<'a>;
type Future<'a>
where
Self: 'a,
= PortInputFuture<'a>;
fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> {
self.pin.pin.conf().modify(|_, w| w.sense().high());
@ -351,7 +354,10 @@ impl<'d, T: GpioPin> WaitForHigh for PortInput<'d, T> {
}
impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> {
type Future<'a> = PortInputFuture<'a>;
type Future<'a>
where
Self: 'a,
= PortInputFuture<'a>;
fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> {
self.pin.pin.conf().modify(|_, w| w.sense().low());
@ -364,7 +370,11 @@ impl<'d, T: GpioPin> WaitForLow for PortInput<'d, T> {
}
impl<'d, T: GpioPin> WaitForAnyEdge for PortInput<'d, T> {
type Future<'a> = PortInputFuture<'a>;
type Future<'a>
where
Self: 'a,
= PortInputFuture<'a>;
fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> {
if self.is_high().ok().unwrap() {
self.pin.pin.conf().modify(|_, w| w.sense().low());

View File

@ -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)

View File

@ -1,7 +1,9 @@
use core::future::Future;
pub trait Delay {
type DelayFuture<'a>: Future<Output = ()> + 'a;
type DelayFuture<'a>: Future<Output = ()> + 'a
where
Self: 'a;
/// Future that completes after now + millis
fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>;

View File

@ -2,7 +2,9 @@ use core::future::Future;
/// Wait for a pin to become high.
pub trait WaitForHigh {
type Future<'a>: Future<Output = ()> + 'a;
type Future<'a>: Future<Output = ()> + '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<Output = ()> + 'a;
type Future<'a>: Future<Output = ()> + '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<Output = ()> + 'a;
type Future<'a>: Future<Output = ()> + '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<Output = ()> + 'a;
type Future<'a>: Future<Output = ()> + '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<Output = ()> + 'a;
type Future<'a>: Future<Output = ()> + '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<'_>;

View File

@ -27,7 +27,8 @@ pub trait Spi<Word> {
pub trait FullDuplex<Word>: Spi<Word> + Write<Word> + Read<Word> {
type WriteReadFuture<'a>: Future<Output = Result<(), Self::Error>> + '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<Word>: Spi<Word> + Write<Word> + Read<Word> {
pub trait Write<Word>: Spi<Word> {
type WriteFuture<'a>: Future<Output = Result<(), Self::Error>> + '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<Word>: Spi<Word> {
pub trait Read<Word>: Write<Word> {
type ReadFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
where
Self: 'a;
Self: 'a,
Word: 'a;
fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>;
}