[−][src]Trait kai::KaiIterator
Generates my custom iterator adapters
For convenience, this is implmented for all types that
implement not just Iterator
,
but IntoIterator
as well.
See methods for usage.
Provided methods
ⓘImportant traits for ChainIf<I, J>fn chain_if<I, F>(self, condition: bool, f: F) -> ChainIf<Self, I> where
I: IntoIterator<Item = Self::Item>,
F: FnMut() -> I,
ⓘImportant traits for ChainIf<I, J>
I: IntoIterator<Item = Self::Item>,
F: FnMut() -> I,
Chain this iterator with another if the condition is true
Example
use kai::*; let condition = true; // Turn this let mut v = vec![1, 2, 3]; if condition { v.extend(vec![4, 5, 6]) } // Into this let w: Vec<_> = vec![1, 2, 3].chain_if(condition, || vec![4, 5, 6]).collect(); assert_eq!(v, w);
Implementors
impl<I> KaiIterator for I where
I: IntoIterator + Sized,
[src]
I: IntoIterator + Sized,