Thanks for this! I’ll see if I can work something like this in.
thejevans
- 0 Posts
- 5 Comments
Joined 3 years ago
Cake day: December 27th, 2022
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
I definitely use that syntax whenever I can. One of the situations where I get stuck with the nested syntax that I shared is when the result of the function call in the for loop affects the inputs for that function call for the next item in the loop. Another is when I am using a heuristic to sort the iterator that I’m looping over such that most of the time I can break from the loop early, which is helpful if the function in the loop is heavy.
How does that change anything? Sorry if it wasn’t clear, this was assuming a function call in the for loop that returns either a Result or enum.
I know it’s not nearly as nested as this, but nesting in Rust annoys the hell out of me.
impl { fn { for { match { case => { } } } } }
is something I’ve run into a few times
You wouldn’t download a car