uefi-async 0.2.8

A lightweight asynchronous executor for UEFI environments.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use core::pin::Pin;
use core::task::{Context, Poll};
use uefi::proto::console::text::{Input, Key};

pub struct KeyInputFuture<'a> {
    text_input: &'a mut Input,
}

impl<'a> Future for KeyInputFuture<'a> {
    type Output = Key;

    fn poll(mut self: Pin<&mut Self>, _: &mut Context) -> Poll<Self::Output> {
        match self.text_input.read_key() {
            Ok(Some(key)) => Poll::Ready(key),
            _ => Poll::Pending,
        }
    }
}