Merge #1236
1236: Add `#[must_use]` to all futures r=Dirbaio a=GrantM11235 I think that's all of them, I just grep'd for `impl.* Future for` Co-authored-by: Grant Miller <GrantM11235@gmail.com>
This commit is contained in:
commit
64247ae456
@ -24,6 +24,7 @@ pub fn yield_now() -> impl Future<Output = ()> {
|
|||||||
YieldNowFuture { yielded: false }
|
YieldNowFuture { yielded: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
struct YieldNowFuture {
|
struct YieldNowFuture {
|
||||||
yielded: bool,
|
yielded: bool,
|
||||||
}
|
}
|
||||||
|
@ -315,6 +315,7 @@ impl<'d, C: Channel, T: GpioPin> OutputChannel<'d, C, T> {
|
|||||||
|
|
||||||
// =======================
|
// =======================
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub(crate) struct PortInputFuture<'a> {
|
pub(crate) struct PortInputFuture<'a> {
|
||||||
pin: PeripheralRef<'a, AnyPin>,
|
pin: PeripheralRef<'a, AnyPin>,
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,7 @@ fn copy_inner<'a, C: Channel>(
|
|||||||
Transfer::new(ch)
|
Transfer::new(ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct Transfer<'a, C: Channel> {
|
pub struct Transfer<'a, C: Channel> {
|
||||||
channel: PeripheralRef<'a, C>,
|
channel: PeripheralRef<'a, C>,
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,7 @@ unsafe fn IO_IRQ_BANK0() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
struct InputFuture<'a, T: Pin> {
|
struct InputFuture<'a, T: Pin> {
|
||||||
pin: PeripheralRef<'a, T>,
|
pin: PeripheralRef<'a, T>,
|
||||||
level: InterruptTrigger,
|
level: InterruptTrigger,
|
||||||
|
@ -120,6 +120,7 @@ unsafe fn PIO1_IRQ_0() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future that waits for TX-FIFO to become writable
|
/// Future that waits for TX-FIFO to become writable
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct FifoOutFuture<'a, PIO: PioInstance, SM: PioStateMachine + Unpin> {
|
pub struct FifoOutFuture<'a, PIO: PioInstance, SM: PioStateMachine + Unpin> {
|
||||||
sm: &'a mut SM,
|
sm: &'a mut SM,
|
||||||
pio: PhantomData<PIO>,
|
pio: PhantomData<PIO>,
|
||||||
@ -182,6 +183,7 @@ impl<'d, PIO: PioInstance, SM: PioStateMachine + Unpin> Drop for FifoOutFuture<'
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future that waits for RX-FIFO to become readable
|
/// Future that waits for RX-FIFO to become readable
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct FifoInFuture<'a, PIO: PioInstance, SM: PioStateMachine> {
|
pub struct FifoInFuture<'a, PIO: PioInstance, SM: PioStateMachine> {
|
||||||
sm: &'a mut SM,
|
sm: &'a mut SM,
|
||||||
pio: PhantomData<PIO>,
|
pio: PhantomData<PIO>,
|
||||||
@ -241,6 +243,7 @@ impl<'d, PIO: PioInstance, SM: PioStateMachine> Drop for FifoInFuture<'d, PIO, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future that waits for IRQ
|
/// Future that waits for IRQ
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct IrqFuture<PIO: PioInstance> {
|
pub struct IrqFuture<PIO: PioInstance> {
|
||||||
pio: PhantomData<PIO>,
|
pio: PhantomData<PIO>,
|
||||||
irq_no: u8,
|
irq_no: u8,
|
||||||
|
@ -273,6 +273,7 @@ mod transfers {
|
|||||||
Transfer::new(channel)
|
Transfer::new(channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub(crate) struct Transfer<'a, C: Channel> {
|
pub(crate) struct Transfer<'a, C: Channel> {
|
||||||
channel: PeripheralRef<'a, C>,
|
channel: PeripheralRef<'a, C>,
|
||||||
}
|
}
|
||||||
|
@ -198,6 +198,7 @@ mod eha {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
struct ExtiInputFuture<'a> {
|
struct ExtiInputFuture<'a> {
|
||||||
pin: u8,
|
pin: u8,
|
||||||
phantom: PhantomData<&'a mut AnyPin>,
|
phantom: PhantomData<&'a mut AnyPin>,
|
||||||
|
@ -181,6 +181,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future returned by [`Channel::recv`] and [`Receiver::recv`].
|
/// Future returned by [`Channel::recv`] and [`Receiver::recv`].
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct RecvFuture<'ch, M, T, const N: usize>
|
pub struct RecvFuture<'ch, M, T, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -203,6 +204,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future returned by [`DynamicReceiver::recv`].
|
/// Future returned by [`DynamicReceiver::recv`].
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct DynamicRecvFuture<'ch, T> {
|
pub struct DynamicRecvFuture<'ch, T> {
|
||||||
channel: &'ch dyn DynamicChannel<T>,
|
channel: &'ch dyn DynamicChannel<T>,
|
||||||
}
|
}
|
||||||
@ -219,6 +221,7 @@ impl<'ch, T> Future for DynamicRecvFuture<'ch, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future returned by [`Channel::send`] and [`Sender::send`].
|
/// Future returned by [`Channel::send`] and [`Sender::send`].
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct SendFuture<'ch, M, T, const N: usize>
|
pub struct SendFuture<'ch, M, T, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -250,6 +253,7 @@ where
|
|||||||
impl<'ch, M, T, const N: usize> Unpin for SendFuture<'ch, M, T, N> where M: RawMutex {}
|
impl<'ch, M, T, const N: usize> Unpin for SendFuture<'ch, M, T, N> where M: RawMutex {}
|
||||||
|
|
||||||
/// Future returned by [`DynamicSender::send`].
|
/// Future returned by [`DynamicSender::send`].
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct DynamicSendFuture<'ch, T> {
|
pub struct DynamicSendFuture<'ch, T> {
|
||||||
channel: &'ch dyn DynamicChannel<T>,
|
channel: &'ch dyn DynamicChannel<T>,
|
||||||
message: Option<T>,
|
message: Option<T>,
|
||||||
|
@ -48,6 +48,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future returned by [`Pipe::write`] and [`Writer::write`].
|
/// Future returned by [`Pipe::write`] and [`Writer::write`].
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct WriteFuture<'p, M, const N: usize>
|
pub struct WriteFuture<'p, M, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
@ -110,6 +111,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Future returned by [`Pipe::read`] and [`Reader::read`].
|
/// Future returned by [`Pipe::read`] and [`Reader::read`].
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct ReadFuture<'p, M, const N: usize>
|
pub struct ReadFuture<'p, M, const N: usize>
|
||||||
where
|
where
|
||||||
M: RawMutex,
|
M: RawMutex,
|
||||||
|
@ -26,6 +26,7 @@ pub async fn with_timeout<F: Future>(timeout: Duration, fut: F) -> Result<F::Out
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A future that completes at a specified [Instant](struct.Instant.html).
|
/// A future that completes at a specified [Instant](struct.Instant.html).
|
||||||
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct Timer {
|
pub struct Timer {
|
||||||
expires_at: Instant,
|
expires_at: Instant,
|
||||||
yielded_once: bool,
|
yielded_once: bool,
|
||||||
|
Loading…
Reference in New Issue
Block a user