#async-executor #future #async-task #futures-executor #local-pool #poll-fn

minimal-executor

A minimal executor for asynchronous tasks based on the futures-rs library

14 releases

0.4.1 Nov 15, 2022
0.4.0 Nov 15, 2022
0.3.0 Nov 1, 2021
0.2.0 Jul 14, 2021
0.1.2 Jun 23, 2021

#1551 in Asynchronous

Download history 10/week @ 2024-07-03 54/week @ 2024-07-24 12/week @ 2024-07-31

105 downloads per month

MIT/Apache

23KB
392 lines

minimal-executor

This is an async executor tailored from futures-executor. It is meant to be as overheadless as possible.

Can be used without std

minimal-executor = { version = "0.3.0", default-features = false }

Basic usage

You can use minimal-executor in three ways: LocalPool, poll_fn and poll_on. They are almost the same as those in futures, but lighter.

fn run_until_single_future() {
    let mut cnt = 0;

    {
        let mut pool = LocalPool::new();
        let fut = lazy(|_| {
            cnt += 1;
        });
        pool.spawn(fut.boxed_local());
        pool.poll_once();
    }

    assert_eq!(cnt, 1);
}

Dependencies

~1.5MB
~29K SLoC