-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(iter_map_windows)]
This is a tracking issue for Iterator::map_windows:
Calls the given function
ffor each contiguous window of sizeNoverselfand returns an iterator over the outputs off.In the following example, the closure is called three times with the arguments
&['a', 'b'],&['b', 'c']and&['c', 'd']respectively.#![feature(iter_map_windows)] let strings = "abcd".chars() .map_windows(|[x, y]| format!("{}+{}", x, y)) .collect::<Vec<String>>(); assert_eq!(strings, vec!["a+b", "b+c", "c+d"]);
Public API
impl Iterator {
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where
Self: Sized,
F: FnMut(&[Self::Item; N]) -> R;
}
struct MapWindows<I: Iterator, F, const N: usize> { ... }
impl<I, F, R, const N: usize> Iterator for MapWindows<I, F, N>
where
I: Iterator,
F: FnMut(&[I::Item; N]) -> R;
impl<I: Iterator + fmt::Debug, F, const N: usize> fmt::Debug for MapWindows<I, F, N>;Steps / History
-
Implementation: AddIterator::map_windows#82413 - Implementation: Add
Iterator::map_windows#94667 - Optimize with buffer of size
2 * N - Any other iterator-related traits?
-
DoubleEndedIterator -
FusedIterator -
TrustedLen
-
- Compile fail on N=0, rather than panic. Blocked on a solution for compile errors in callers that are generic over
Nand would want a fallback for N=0. - Final comment period (FCP)
- Stabilization PR
Unresolved Questions
&[I::Item; N]vsArrayView<'_, I::Item, N>Tracking Issue forIterator::map_windows(featureiter_map_windows) #87155 (comment)
hellow554, SkiFire13, zohnannor, ronnodas, MarcellPerger1 and 19 moreSDesya74 and odilf
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.