embedded_platform/gpio/
set.rs1use core::future;
3use core::pin;
4use core::task;
5
6#[derive(Debug)]
8#[must_use = "futures do nothing unless you `.await` or poll them"]
9pub struct Set<'a, A>
10where
11 A: super::OutputPin + Unpin + ?Sized,
12{
13 pin: &'a mut A,
14 high: bool,
15}
16
17pub fn set<A>(pin: &mut A, high: bool) -> Set<A>
20where
21 A: super::OutputPin + Unpin + ?Sized,
22{
23 Set { pin, high }
24}
25
26impl<A> future::Future for Set<'_, A>
27where
28 A: super::OutputPin + Unpin + ?Sized,
29{
30 type Output = Result<(), A::Error>;
31
32 fn poll(mut self: pin::Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<Self::Output> {
33 let this = &mut *self;
34 pin::Pin::new(&mut *this.pin).poll_set(cx, this.high)
35 }
36}