mirror of https://github.com/rust-lang/rust
994e712162
Repeat iterator always returns the same element and behaves the same way backwards and forwards. Take iterator can trivially implement backwards iteration over Repeat inner iterator by simply doing forwards iteration. DoubleEndedIterator is not currently implemented for Take<Repeat<T>> because Repeat doesn’t implement ExactSizeIterator which is a required bound on DEI implementation for Take. Similarly, since Repeat is an infinite iterator which never stops, Take can trivially know how many elements it’s going to return. This allows implementing ExactSizeIterator on Take<Repeat<T>>. While at it, observe that ExactSizeIterator can also be implemented for Take<RepeatWhile<F>> so add that implementation too. Since in contrast to Repeat, RepeatWhile doesn’t guarante to always return the same value, DoubleEndedIterator isn’t implemented. Those changes render core::iter::repeat_n somewhat redundant. Issue: https://github.com/rust-lang/rust/issues/104434 Issue: https://github.com/rust-lang/rust/issues/104729 |
||
---|---|---|
.. | ||
array_chunks.rs | ||
by_ref_sized.rs | ||
chain.rs | ||
cloned.rs | ||
copied.rs | ||
cycle.rs | ||
enumerate.rs | ||
filter.rs | ||
filter_map.rs | ||
flat_map.rs | ||
flatten.rs | ||
fuse.rs | ||
inspect.rs | ||
intersperse.rs | ||
map.rs | ||
map_windows.rs | ||
mod.rs | ||
peekable.rs | ||
scan.rs | ||
skip.rs | ||
skip_while.rs | ||
step_by.rs | ||
take.rs | ||
take_while.rs | ||
zip.rs |