| Crates.io | async-func |
| lib.rs | async-func |
| version | 0.2.6 |
| created_at | 2025-01-18 05:22:32.049887+00 |
| updated_at | 2025-04-06 00:16:13.248281+00 |
| description | 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. |
| homepage | |
| repository | https://github.com/ltpp-universe/async-func |
| max_upload_size | |
| id | 1521369 |
| size | 18,448 |
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.
To install async-func run cmd:
cargo add async-func
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;
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
For any inquiries, please reach out to the author at ltpp-universe root@ltpp.vip.