macro-while-mut

Crates.iomacro-while-mut
lib.rsmacro-while-mut
version0.1.1
sourcesrc
created_at2021-09-17 10:23:01.598672
updated_at2021-09-17 10:34:10.796623
descriptionMacro that allows create while-cycle with mutable condition state
homepage
repository
max_upload_size
id452727
size2,232
Matvey (Khmhmm)

documentation

README

Macro while_mut!

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");

License

Licensed under MIT.

Commit count: 0

cargo fmt