macro-while-mut 0.1.1

Macro that allows create while-cycle with mutable condition state
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 1.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 109.84 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Khmhmm

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.