Skip to content

Desdaemon/for_let

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

for_let

Crates.io docs.rs

That one syntax sugar library you (may have) wished you wrote yourself.

This library provides the for_let! macro, so you can write code like this:

for_let!(Some(Complex(Pattern(foo))) in iteratee {
    // do stuff
});

Which is just sugar for this:

for el in iteratee {
    match el {
        Some(Complex(Pattern(foo))) => {
            // do stuff
        }
        _ => {}
    }
}

Accepts all patterns that are legal in a match arm. How Pythonic!

About

Syntax sugar for a for-loop + pattern binding

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages