Crates.io | macro-while-mut |
lib.rs | macro-while-mut |
version | 0.1.1 |
source | src |
created_at | 2021-09-17 10:23:01.598672 |
updated_at | 2021-09-17 10:34:10.796623 |
description | Macro that allows create while-cycle with mutable condition state |
homepage | |
repository | |
max_upload_size | |
id | 452727 |
size | 2,232 |
This crate defines macro that allows you use while with mutable conditions, such as collection's length. To use that just type:
while_mut!{
$condition,
{
$code
}
For example,
let mut i=0usize;
let mut v = (1..10).collect::<Vec<i32>>();
while_mut!{
i<v.len(),
{
v.remove(0);
i+=1;
println!("{} {}",i,v.len());
}
}
println!("Done");
Licensed under MIT.