for_ch 0.1.1

to flatten nested for-loop
Documentation
for_ch-0.1.1 has been yanked.

for_ch

for_ch named "for_each", "for_chain"(or even "4ch"), the crate provides a macro to flatten the nested for-loop and if-let.

Example

for_ch! {
    for x in 0..10; 
    for y in x..10; // you can add a label before `for`
    if let Some(z) = foo(x, y).await?;
    if x - y < z { continue; }
    println!("x = {}, y = {}, z = {}", x, y, z);
}

would expend to

for x in 0..10 {
    for y in x..10 {
        if let Some(z) = foo(x, y).await? {
            if x - y < z { continue; }
            println!("x = {}, y = {}, z = {}", x, y, z);
        }
    }
}