Crates.io | ct-for |
lib.rs | ct-for |
version | 0.1.1 |
source | src |
created_at | 2022-02-16 10:06:53.914597 |
updated_at | 2022-02-16 10:11:19.580229 |
description | macro to repeat code multiple times with different substitutions |
homepage | |
repository | https://github.com/rob2309/ct-for-rs |
max_upload_size | |
id | 533241 |
size | 9,131 |
This crate exposes the ct-for!()
macro, which can be used to repeat code n
times with a substitution.
For example:
let c = 17;
ct_for!(x in ["5", 6, c, vec![5, 6, 7]] do
println!("{:?}", x);
);
expands to:
let c = 17;
println!("{:?}", "5");
println!("{:?}", 6);
println!("{:?}", c);
println!("{:?}", vec![5, 6, 7]);
The ct_for!()
macro can also be nested.
There really isn't much more to it.