I miss the "foreach" method for Options in #rustlang (and no, iter() isn't the same, since I still have to case match against the elements)
-
-
I think I didn't express myself clearly :) map() in Scala and Rust execute a lambda over the value of an option if it's defined
-
it's just a convenience(nbd!), since I don't have to do: opt.map(|o| { func(o); () }) if I want to ignore the return from func
- 1 more reply
New conversation -
-
-
But Scala has an additional method foreach() that executes a lambda but does not transform Option<T> to Option<U>
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.