You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What do you think of the idea of implementing the new From for Option for some libcore functions like filter_map? The benefit would be to return just a value T instead of Some(T).
Best regards,
Sascha
The text was updated successfully, but these errors were encountered:
I assume you mean changing the return type of the closure in Iterator::filter_map from Option<B> to a generic O: Into<Option<B>>. The problem is that even if the return type is generic, for one given closure it has to be the same in all code paths. So any closure that sometimes returns B (taking advantage of the new From<B> for Option<B> impl) instead of Option<B> has to always do so and thus acts as if it were always returning Some(_: B). In that case there is no point in using filter_map, map could be used instead.
Hey 👋 there,
What do you think of the idea of implementing the new From for Option for some libcore functions like
filter_map
? The benefit would be to return just a valueT
instead ofSome(T)
.Best regards,
Sascha
The text was updated successfully, but these errors were encountered: