https://github.com/desdaemon/for_let
Syntax sugar for a for-loop + pattern binding
https://github.com/desdaemon/for_let
fun macros rust
Last synced: about 1 year ago
JSON representation
Syntax sugar for a for-loop + pattern binding
- Host: GitHub
- URL: https://github.com/desdaemon/for_let
- Owner: Desdaemon
- License: mit
- Created: 2022-12-22T06:27:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-22T06:50:51.000Z (over 3 years ago)
- Last Synced: 2025-06-01T10:33:02.771Z (about 1 year ago)
- Topics: fun, macros, rust
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# for_let
[](https://crates.io/crates/for_let)
[](https://docs.rs/for_let/latest/for_let/)
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:
```rust
for_let!(Some(Complex(Pattern(foo))) in iteratee {
// do stuff
});
```
Which is just sugar for this:
```rust
for el in iteratee {
match el {
Some(Complex(Pattern(foo))) => {
// do stuff
}
_ => {}
}
}
```
Accepts all patterns that are legal in a match arm. How Pythonic!