#macro #standard #structures #simplifying #extension

async-func

A Rust library providing macros to simplify the creation of asynchronous closures with external state captured by move. Useful for structuring asynchronous code with ease and clarity.

14 releases

Uses new Rust 2024

new 0.2.3 Mar 23, 2025
0.2.2 Mar 23, 2025
0.1.8 Mar 11, 2025
0.1.5 Feb 9, 2025
0.0.1 Jan 18, 2025

#1332 in Data structures

Download history 52/week @ 2025-01-12 408/week @ 2025-01-19 14/week @ 2025-01-26 69/week @ 2025-02-02 411/week @ 2025-02-09 174/week @ 2025-02-16 111/week @ 2025-02-23 403/week @ 2025-03-02 504/week @ 2025-03-09 342/week @ 2025-03-16

1,380 downloads per month
Used in 5 crates (3 directly)

MIT license

7KB

async-func

Official Documentation

A Rust library providing macros to simplify the creation of asynchronous closures with external state captured by move. Useful for structuring asynchronous code with ease and clarity.

Installation

To install async-func run cmd:

cargo add async-func

Usage

use async_func::*;

let string: String = String::from("test");
let number: i32 = 1;
let func = async_func!(string, number, {
    let tmp_string: String = String::from("test");
    assert_eq!(string, tmp_string);
    assert_eq!(number, 1);
});
func().await;

let func = async_func!(string, number, |data| {
    let tmp_string: String = String::from("test");
    assert_eq!(string, tmp_string);
    assert_eq!(data, 1);
    assert_eq!(number, 1);
});
func(1).await;

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Contact

For any inquiries, please reach out to the author at ltpp-universe root@ltpp.vip.

Dependencies

~2.3–8.5MB
~58K SLoC