[−][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.
Implementations
impl<F> IterConstructor<F>
[src]
Trait Implementations
impl<F: Clone> Clone for IterConstructor<F>
[src]
pub fn clone(&self) -> IterConstructor<F>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Copy> Copy for IterConstructor<F>
[src]
impl<F, I> IntoIterator for IterConstructor<F> where
F: FnOnce() -> I,
I: Iterator,
[src]
F: FnOnce() -> I,
I: Iterator,
Auto Trait Implementations
impl<F> RefUnwindSafe for IterConstructor<F> where
F: RefUnwindSafe,
[src]
F: RefUnwindSafe,
impl<F> Send for IterConstructor<F> where
F: Send,
[src]
F: Send,
impl<F> Sync for IterConstructor<F> where
F: Sync,
[src]
F: Sync,
impl<F> Unpin for IterConstructor<F> where
F: Unpin,
[src]
F: Unpin,
impl<F> UnwindSafe for IterConstructor<F> where
F: UnwindSafe,
[src]
F: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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 error type returned when the conversion fails.
pub fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,