minimal-executor

Crates.iominimal-executor
lib.rsminimal-executor
version0.4.1
sourcesrc
created_at2021-06-23 12:35:36.13963
updated_at2022-11-15 06:00:58.096071
descriptionA minimal executor for asynchronous tasks based on the futures-rs library.
homepage
repositoryhttps://github.com/qiujiangkun/minimal-executor
max_upload_size
id413905
size25,802
Jakku Sakura (JakkuSakura)

documentation

README

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);
}

Commit count: 20

cargo fmt