the.bay.news

Implementing a find_map iterator for multiple searches

The Rust Programming Language Forum
Implementing a find_map iterator for multiple searches
the code is here the issue i'm trying to solve there's find_map: consume an iterator, evaluate a FnMut, first time a Some gets returned abort and return it. ✓ no need to loop through the entire range ✓ if you need to do some computation with the found result and the computation is somewhat related to the search criterion, you don't need to do work twice, you can do find and map in one call now what if i have >1 independent things that need to be find_maped? I could do let a = iter.find_map(...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.