vexide_async/lib.rs
1//! Tiny async runtime for `vexide`.
2//!
3//! The async executor supports spawning tasks and blocking on futures.
4//! It has a reactor to improve the performance of some futures.
5
6#![no_std]
7
8extern crate alloc;
9
10mod executor;
11mod reactor;
12
13pub mod task;
14pub mod time;
15
16use core::future::Future;
17
18use executor::EXECUTOR;
19pub use task::spawn;
20
21/// Blocks the current task until a return value can be extracted from the provided future.
22///
23/// Does not poll all futures to completion.
24pub fn block_on<F: Future + 'static>(future: F) -> F::Output {
25 let task = spawn(future);
26 EXECUTOR.block_on(task)
27}