#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

#224 in #context

39 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

~285–750KB
~17K SLoC