woven 0.1.0

A simple set of async combinators, usable in a no_std environment.
Documentation
  • Coverage
  • 100%
    160 out of 160 items documented1 out of 22 items with examples
  • Size
  • Source code size: 23.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 14.32 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • reed-smout/woven
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • NZRosto

A simple set of async combinators, usable in a no_std, no_alloc environment.

Technical Note

Because of it's simplicity, Woven doesn't implement granular wakers, so an executer has no way of knowing which task woke it. This usually leads to all the combined futures being polled again, regardless of which one actually woke the executor. It's up to you whether this is acceptable or not.

Usage

See cassette for the executor used in the examples.

Join

use woven::Join;

cassette::block_on(async {
    let future1 = async { 1 };
    let future2 = async { 2 };
    let future3 = async { 3 };

    let result = (future1, future2, future3).join().await;
    assert_eq!(result, (1, 2, 3));
});

Race

use woven::{Race, Either3};

cassette::block_on(async {
    let future1 = async { 1 };
    let future2 = async { 2 };
    let future3 = async { 3 };

    let result = (future1, future2, future3).race().await;
    assert_eq!(result, Either3::First(1)); // If multiple futures complete at the same time, the first one is returned.
});

Race Same

use woven::RaceSame;

cassette::block_on(async {
    let future1 = async { 1 };
    let future2 = async { 2 };
    let future3 = async { 3 };

    let result = (future1, future2, future3).race_same().await;
    assert_eq!(result, 1); // If multiple futures complete at the same time, the first one is returned.
});