Struct Repeat

pub struct Repeat<A> { pub(in ::iter::sources::repeat) element: A }

An iterator that repeats an element endlessly.

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

Fields

element: A

Trait Implementations

impl<A: Clone> Clone for Repeat<A>

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

impl<A: Clone> DoubleEndedIterator for Repeat<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>

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

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

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

Consumes the iterator and panics.

Panics

This method always panics because Repeat is infinite.

fn count(self) -> usize

Consumes the iterator and panics.

Panics

This method always panics because Repeat is infinite.

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

impl<A: Debug> Debug for Repeat<A>

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

Auto Trait Implementations

impl<A> Freeze for Repeat<A> where A: Freeze,

impl<A> RefUnwindSafe for Repeat<A> where A: RefUnwindSafe,

impl<A> Send for Repeat<A> where A: Send,

impl<A> Sync for Repeat<A> where A: Sync,

impl<A> Unpin for Repeat<A> where A: Unpin,

impl<A> UnsafeUnpin for Repeat<A> where A: UnsafeUnpin,

impl<A> UnwindSafe for Repeat<A> where A: UnwindSafe,

Blanket Implementations

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

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Repeat<A>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T> SizedTypeProperties for Repeat<A>

impl<T, U> Into<U> for Repeat<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 Repeat<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 Repeat<A> where U: TryFrom<T>,

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