| Crates.io | everyday_macros |
| lib.rs | everyday_macros |
| version | 0.1.0 |
| created_at | 2020-12-25 11:19:21.082497+00 |
| updated_at | 2020-12-25 11:19:21.082497+00 |
| description | This crate contains all the procedural macros you might use in your everyday life while coding. Things like a thread sleep timer or a retry on error. |
| homepage | https://github.com/P3GLEG/everyday_macros |
| repository | https://github.com/P3GLEG/everyday_macros |
| max_upload_size | |
| id | 327143 |
| size | 24,392 |
This crate contains all the procedural macros you might use in your everyday life while coding. Things like a thread sleep timer or a retry on error.
To a thread sleep timer to the prologue of your function. It is uses std::thread::sleep for default functions and tokio::time::sleep for async. It also has the ability to add a jitter with a range of [0, N).
#[wait_for(seconds=3)]
fn my_func_to_sleep(args: any_amount){
...
}
#[wait_for(seconds=3, jitter)]
fn my_func_to_sleep(args: any_amount){
...
}
To add a harness around your function add the follow above it. Currently does not work on async!
#[retry(times=3)]
fn my_func_that_can_fail(args: any_amount) -> Result<(), Err>{
...
}
Just run
git clone https://github.com/P3GLEG/everyday_macros && cd everyday_macros
cargo test -- --color always --nocapture
This project is licensed under the Apache 2.0 License - see the LICENSE file for details