[][src]Struct core_extensions::iterators::Loop

pub struct Loop<F>(pub F);

Iterator that infinitelly produces a value by calling an impl FnMut()->T.

Equivalent to ::std::iter::RepeatWith,which is stabilized in Rust 1.28.

Example

use core_extensions::iterators::Loop;

let mut i=0;
assert_eq!(
    Loop(move||{ i+=1; i }).take(5).collect::<Vec<_>>() ,
    vec![1,2,3,4,5]
);

Trait Implementations

impl<F, T> Iterator for Loop<F> where
    F: FnMut() -> T, 
[src]

type Item = T

The type of the elements being iterated over.

impl<F: Clone> Clone for Loop<F>[src]

impl<F: Copy> Copy for Loop<F>[src]

Auto Trait Implementations

impl<F> Send for Loop<F> where
    F: Send

impl<F> Sync for Loop<F> where
    F: Sync

impl<F> Unpin for Loop<F> where
    F: Unpin

impl<F> UnwindSafe for Loop<F> where
    F: UnwindSafe

impl<F> RefUnwindSafe for Loop<F> where
    F: RefUnwindSafe

Blanket Implementations

impl<I> IteratorExt for I where
    I: Iterator
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The error type returned when the conversion fails.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]