Skip to content
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

Use try_fold in default implementation of collect_seq, collect_map #2077

Merged
merged 1 commit into from Aug 21, 2021

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Aug 21, 2021

I noticed this in https://github.com/jonasbb/serde_with/blob/c578069eab2f64fd672b6dbd40068b36dd256f84/src/rust.rs#L1174 and it seems like a good idea because some iterator adapters, like Chain, are able to perform more efficiently in internal iteration than external iteration. See https://doc.rust-lang.org/1.54.0/std/iter/trait.Iterator.html#method.for_each.

@dtolnay dtolnay merged commit 55fdbea into serde-rs:master Aug 21, 2021
@dtolnay dtolnay deleted the tryfold branch August 21, 2021 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant