#context #async #function

nightly async-context

Provide context to async functions

2 releases

0.1.1 Jul 15, 2024
0.1.0 Jul 15, 2024

#195 in #context

Download history 242/week @ 2024-07-15 25/week @ 2024-07-22 6/week @ 2024-07-29 7/week @ 2024-08-12 7/week @ 2024-08-19 30/week @ 2024-08-26 8/week @ 2024-09-02

52 downloads per month
Used in 4 crates (via bloom-core)

MIT license

5KB
88 lines

async-content

This crate provides an easy way to provide context to async functions.

Use provide_async_context to provide the context:

provide_async_context(16, async {
    with_async_context(|my_number| {
        assert_eq!(my_number, 16);
    })
}).await

lib.rs:

A way to have some context within async functions. This can be used to implement React-like hooks.

Dependencies

~320–790KB
~18K SLoC