| use std::iter::FusedIterator; |
| /// An iterator that produces *n* repetitions of an element. |
| /// See [`repeat_n()`](crate::repeat_n) for more information. |
| #[must_use = "iterators are lazy and do nothing unless consumed"] |
| /// Create an iterator that produces `n` repetitions of `element`. |
| pub fn repeat_n<A>(element: A, n: usize) -> RepeatN<A> |
| RepeatN { elt: None, n, } |
| RepeatN { elt: Some(element), n, } |
| impl<A> Iterator for RepeatN<A> |
| fn next(&mut self) -> Option<Self::Item> { |
| self.elt.as_ref().cloned() |
| fn size_hint(&self) -> (usize, Option<usize>) { |
| impl<A> DoubleEndedIterator for RepeatN<A> |
| fn next_back(&mut self) -> Option<Self::Item> { |
| impl<A> ExactSizeIterator for RepeatN<A> |
| impl<A> FusedIterator for RepeatN<A> |