Feature gate: #![feature(iter_repeat_n)]
This is a tracking issue for the iter::repeat_n function and its associated iter::RepeatN type.
This is like repeat, but count-limited so it can re-use the buffer when generating the last item.
ACP rust-lang/libs-team#120 is still open, but I'm sending a PR for it anyway as part of fixing a bug in VecDeque.
Public API
// core::iter
fn repeat_n<T>(element: T, count: usize) -> RepeatN<T>;
pub struct RepeatN<T>(…);
impl<T: Clone> Iterator for RepeatN<T> { … }
impl<T: Clone> DoubleEndedIterator for RepeatN<T> { … }
impl<T: Clone> ExactSizeIterator for RepeatN<T> { … }
impl<T: Clone> FusedIterator for RepeatN<T> { … }
impl<T: Clone> TrustedLen for RepeatN<T> { … }
Steps / History
Unresolved Questions
Feature gate:
#![feature(iter_repeat_n)]This is a tracking issue for the
iter::repeat_nfunction and its associatediter::RepeatNtype.This is like
repeat, but count-limited so it can re-use the buffer when generating the last item.ACP rust-lang/libs-team#120 is still open, but I'm sending a PR for it anyway as part of fixing a bug inVecDeque.Public API
Steps / History
doc(hidden):VecDeque::resizeshould re-use the buffer in the passed-in element #104435iter::repeat_nfrom itertools libs-team#120iter::repeat_n#120045Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩