-
Notifications
You must be signed in to change notification settings - Fork 13.4k
iter::fuse not behaving as expected #51119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The fn main() {
let mut iter = ["0", "a", "1", "2"].iter().map(|x| x.parse::<i32>().ok());
for _ in 0..5 {
println!("{:?}", iter.next());
}
// => Some(Some(0)), Some(None), Some(Some(1)), Some(Some(2)), None
} The |
Somewhat related to #50225 ? |
Yeah, this is behaving as expected. fuse is about iterators that may "start" again after finishing, not about iterators over an option. |
This is how fused is supposed to behave. |
The docs led me to believe that fuse would yield items until it saw a None, and then yield only Nones. Maybe I'm misunderstanding, but
outputs
whereas I'd expect to see something like
it:[Some(0), None, None, None]
rustc 1.28.0-nightly (cb20f68 2018-05-21)
The text was updated successfully, but these errors were encountered: