| Crates.io | for_let |
| lib.rs | for_let |
| version | 0.1.0 |
| created_at | 2022-12-22 06:33:10.249378+00 |
| updated_at | 2022-12-22 06:33:10.249378+00 |
| description | Syntax sugar for a for-loop + pattern binding |
| homepage | |
| repository | https://github.com/Desdaemon/for_let |
| max_upload_size | |
| id | 743700 |
| size | 23,023 |
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!