everyday_macros

Crates.ioeveryday_macros
lib.rseveryday_macros
version0.1.0
sourcesrc
created_at2020-12-25 11:19:21.082497
updated_at2020-12-25 11:19:21.082497
descriptionThis 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.
homepagehttps://github.com/P3GLEG/everyday_macros
repositoryhttps://github.com/P3GLEG/everyday_macros
max_upload_size
id327143
size24,392
Pegleg (P3GLEG)

documentation

https://docs.rs/everyday_macros

README

everyday_macros

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.

Getting Started

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>{
		...
	}

Running the tests

Just run

git clone https://github.com/P3GLEG/everyday_macros && cd everyday_macros
cargo test -- --color always --nocapture

Authors

  • Paul Ganea - Initial work - pegleg

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

Commit count: 4

cargo fmt