embedded_platform/gpio/
get.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 Get<'a, A>
10where
11 A: super::InputPin + Unpin + ?Sized,
12{
13 pin: &'a mut A,
14}
15
16pub fn get<A>(pin: &mut A) -> Get<A>
18where
19 A: super::InputPin + Unpin + ?Sized,
20{
21 Get { pin }
22}
23
24impl<A> future::Future for Get<'_, A>
25where
26 A: super::InputPin + Unpin + ?Sized,
27{
28 type Output = Result<bool, A::Error>;
29
30 fn poll(mut self: pin::Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<Self::Output> {
31 let this = &mut *self;
32 pin::Pin::new(&mut *this.pin).poll_get(cx)
33 }
34}