[−][src]Struct core_extensions::iterators::IterConstructor
Constructs Iterators using a closure.
This can construct an Iterator (with IntoIterator::into_iter) multiple times if the closure is Copy.
Closures can be Copy and/or Clone since Rust 1.26.
Example
This example only runs from Rust 1.26 onwards,
use core_extensions::iterators::IterConstructor; let list=vec!["hello","world"]; let constructor=IterConstructor::new(||{ list.iter().enumerate().map(|(i,v)| v.repeat(i) ) }); let list_2=vec!["".to_string(),"world".into()]; assert_eq!(constructor.into_iter().collect::<Vec<_>>() , list_2); assert_eq!(constructor.into_iter().collect::<Vec<_>>() , list_2);
Fields
f: F
The closure.
Methods
impl<F> IterConstructor<F>
[src]
Trait Implementations
impl<F, I> IntoIterator for IterConstructor<F> where
F: FnOnce() -> I,
I: Iterator,
[src]
F: FnOnce() -> I,
I: Iterator,
type Item = I::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<F: Clone> Clone for IterConstructor<F>
[src]
fn clone(&self) -> IterConstructor<F>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Copy> Copy for IterConstructor<F>
[src]
Auto Trait Implementations
impl<F> Send for IterConstructor<F> where
F: Send,
F: Send,
impl<F> Sync for IterConstructor<F> where
F: Sync,
F: Sync,
impl<F> Unpin for IterConstructor<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for IterConstructor<F> where
F: UnwindSafe,
F: UnwindSafe,
impl<F> RefUnwindSafe for IterConstructor<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
Blanket Implementations
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The error type returned when the conversion fails.
fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,