-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add Pair adaptor for Iterator to return elements two at a time #14528
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
Conversation
@Ryman You should comment on the Files Changed tab instead of the commit directly. That way we can see the context of your comment on the Conversation tab, and also track older comments after the PR has been updated. |
This seems like an absurdly specialized iterator, especially for a single use-case. If we had integral generic parameters, then an iterator that returns
let mut char_iter = data.chars().filter_scan(None, |st, x| st.take().map(|a| (a,x)).or_else(|| { *st = Some(x); None })); |
/// # Example | ||
/// | ||
/// ```rust | ||
/// let xs = "10ab20cde".chars().pair(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this let-binding doing here?
@kballard: I think if i was the committer, i'd be happier to read something like |
Hi guys, thanks for the comments. The efficiency issues and read-after- As for the specialization of this adaptor, I had thought that I had more use-cases than just hexadecimal parsing, but in fact I can't think of one outside of string parsing, in which case it would be much more generally useful to implement |
…v, r=Veykril Add bounds for fields in derive macro, second try
Not all host tools platforms support `f16`/`f128` builtins yet due to LLVM assertion failures and miscompilations. Until them, Clippy should avoid using `f16`/`f128` at runtime itself. See rust-lang#137630. cc @tgross35 changelog: none
I need this adaptor to read hexadecimal strings (as seen in the example in the doc comment), and I think it'd be more generally useful.