Struct RepeatN

pub struct RepeatN<A> { pub(in ::iter::sources::repeat_n) inner: Option<RepeatNInner<A>> }

An iterator that repeats an element an exact number of times.

This struct is created by the [repeat_n()] function. See its documentation for more.

Fields

inner: Option<RepeatNInner<A>>

Implementations

impl<A> RepeatN<A>

fn take_element(&mut self) -> Option<A>

If we haven't already dropped the element, return it in an option.

Trait Implementations

impl<A> Default for RepeatN<A>

fn default() -> Self

impl<A: Clone> Clone for RepeatN<A>

fn clone(&self) -> RepeatN<A>

impl<A: Clone> DoubleEndedIterator for RepeatN<A>

fn next_back(&mut self) -> Option<A>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn nth_back(&mut self, n: usize) -> Option<A>
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where
    F: FnMut(B, A) -> R,
    R: Try<Output = B>,
fn rfold<B, F>(self, init: B, f: F) -> B
where
    F: FnMut(B, A) -> B,

impl<A: Clone> ExactSizeIterator for RepeatN<A>

fn len(&self) -> usize

impl<A: Clone> FusedIterator for RepeatN<A>

impl<A: Clone> Iterator for RepeatN<A>

type Item = A;
fn next(&mut self) -> Option<A>
fn size_hint(&self) -> (usize, Option<usize>)
fn advance_by(&mut self, skip: usize) -> Result<(), NonZero<usize>>
fn last(self) -> Option<A>
fn count(self) -> usize

impl<A: Clone> TrustedLen for RepeatN<A>

impl<A: Debug> Debug for RepeatN<A>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl<A> Freeze for RepeatN<A> where Option<RepeatNInner<A>>: Freeze,

impl<A> RefUnwindSafe for RepeatN<A> where Option<RepeatNInner<A>>: RefUnwindSafe,

impl<A> Send for RepeatN<A> where Option<RepeatNInner<A>>: Send,

impl<A> Sync for RepeatN<A> where Option<RepeatNInner<A>>: Sync,

impl<A> Unpin for RepeatN<A> where Option<RepeatNInner<A>>: Unpin,

impl<A> UnsafeUnpin for RepeatN<A> where Option<RepeatNInner<A>>: UnsafeUnpin,

impl<A> UnwindSafe for RepeatN<A> where Option<RepeatNInner<A>>: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for RepeatN<A> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for RepeatN<A> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for RepeatN<A> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for RepeatN<A> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for RepeatN<A> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for RepeatN<A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for RepeatN<A> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for RepeatN<A>

impl<T, U> Into<U> for RepeatN<A> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for RepeatN<A> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for RepeatN<A> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>