13 releases
0.3.7 | Aug 8, 2022 |
---|---|
0.3.6 | Apr 24, 2022 |
0.3.3 | Jul 27, 2021 |
0.3.2 | Mar 26, 2021 |
0.1.2 | Mar 23, 2021 |
#451 in Embedded development
22 downloads per month
Used in 9 crates
(3 directly)
12KB
152 lines
Task-Stream
task-stream is a global task executor, can run in no_std
.
Usage
spawn
async fn async_task() {
println!("async_task.");
}
task_stream::spawn(async_task());
executor
without async executor
use core::time::Duration;
use std::thread;
fn main() {
let stream = task_stream::stream();
loop {
while let Some(task) = stream.get_task() {
task.run();
}
thread::sleep(Duration::from_millis(100));
}
}
use async executor
use async_std::prelude::*;
use async_std::task;
fn main() {
task::spawn(async {
let mut stream = task_stream::stream();
while let Some(task) = stream.next().await {
task.run();
}
});
}
Dependencies
~0.7–1.1MB
~20K SLoC