Trait internal_iterator::InternalIterator[][src]

pub trait InternalIterator: Sized {
    type Item;
    fn find_map<F, R>(self, f: F) -> Option<R>
    where
        F: FnMut(Self::Item) -> Option<R>
; fn all<F>(self, f: F) -> bool
    where
        F: FnMut(Self::Item) -> bool
, { ... }
fn any<F>(self, f: F) -> bool
    where
        F: FnMut(Self::Item) -> bool
, { ... }
fn chain<U>(
        self,
        other: U
    ) -> Chain<Self, <U as IntoInternalIterator>::IntoIter>
    where
        U: IntoInternalIterator<Item = Self::Item>
, { ... }
fn cloned<'a, T: 'a>(self) -> Cloned<Self>
    where
        Self: InternalIterator<Item = &'a T>,
        T: Clone
, { ... }
fn collect<B>(self) -> B
    where
        B: FromIternalIterator<Self::Item>
, { ... }
fn copied<'a, T: 'a>(self) -> Copied<Self>
    where
        Self: InternalIterator<Item = &'a T>,
        T: Copy
, { ... }
fn count(self) -> usize { ... }
fn enumerate(self) -> Enumerate<Self> { ... }
fn filter<P>(self, predicate: P) -> Filter<Self, P>
    where
        P: FnMut(&Self::Item) -> bool
, { ... }
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
    where
        F: FnMut(Self::Item) -> Option<T>
, { ... }
fn find<F>(self, f: F) -> Option<Self::Item>
    where
        F: FnMut(&Self::Item) -> bool
, { ... }
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, F>
    where
        F: FnMut(Self::Item) -> U,
        U: IntoInternalIterator
, { ... }
fn for_each<F>(self, f: F)
    where
        F: FnMut(Self::Item)
, { ... }
fn inspect<F>(self, f: F) -> Inspect<Self, F>
    where
        F: FnMut(&Self::Item)
, { ... }
fn last(self) -> Option<Self::Item> { ... }
fn map<F, T>(self, f: F) -> Map<Self, F>
    where
        F: FnMut(Self::Item) -> T
, { ... }
fn max(self) -> Option<Self::Item>
    where
        Self::Item: Ord
, { ... }
fn max_by<F>(self, compare: F) -> Option<Self::Item>
    where
        F: FnMut(&Self::Item, &Self::Item) -> Ordering
, { ... }
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
    where
        F: FnMut(&Self::Item) -> B,
        B: Ord
, { ... }
fn min(self) -> Option<Self::Item>
    where
        Self::Item: Ord
, { ... }
fn min_by<F>(self, compare: F) -> Option<Self::Item>
    where
        F: FnMut(&Self::Item, &Self::Item) -> Ordering
, { ... }
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
    where
        F: FnMut(&Self::Item) -> B,
        B: Ord
, { ... }
fn nth(self, n: usize) -> Option<Self::Item> { ... }
fn partition<B, F>(self, f: F) -> (B, B)
    where
        F: FnMut(&Self::Item) -> bool,
        B: Default + Extend<Self::Item>
, { ... }
fn position<F>(self, f: F) -> Option<usize>
    where
        F: FnMut(Self::Item) -> bool
, { ... }
fn skip(self, n: usize) -> Skip<Self> { ... }
fn take(self, n: usize) -> Take<Self> { ... } }

Associated Types

Loading content...

Required methods

fn find_map<F, R>(self, f: F) -> Option<R> where
    F: FnMut(Self::Item) -> Option<R>, 
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = ["lol", "two", "NaN", "4", "5"];

let parsed = a
    .iter()
    .into_internal()
    .find_map(|x| x.parse().ok());

assert_eq!(parsed, Some(4));
Loading content...

Provided methods

fn all<F>(self, f: F) -> bool where
    F: FnMut(Self::Item) -> bool
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];
assert!(a.iter().into_internal().all(|&x| x > 0));
assert!(!a.iter().into_internal().all(|&x| x < 2));

fn any<F>(self, f: F) -> bool where
    F: FnMut(Self::Item) -> bool
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];
assert!(a.iter().into_internal().any(|&x| x == 2));
assert!(!a.iter().into_internal().any(|&x| x > 5));

fn chain<U>(
    self,
    other: U
) -> Chain<Self, <U as IntoInternalIterator>::IntoIter> where
    U: IntoInternalIterator<Item = Self::Item>, 
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a1 = [1, 2, 3];
let a2 = [4, 5, 6];

let chained = a1.iter().into_internal()
    .chain(a2.iter().into_internal())
    .collect::<Vec<_>>();

assert_eq!(chained, vec![&1, &2, &3, &4, &5, &6]);

fn cloned<'a, T: 'a>(self) -> Cloned<Self> where
    Self: InternalIterator<Item = &'a T>,
    T: Clone
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

let cloned = a.iter().into_internal().cloned().collect::<Vec<_>>();

assert_eq!(cloned, vec![1, 2, 3]);

fn collect<B>(self) -> B where
    B: FromIternalIterator<Self::Item>, 
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

let doubled = a
    .iter()
    .into_internal()
    .map(|&x| x * 2)
    .collect::<Vec<_>>();

assert_eq!(doubled, vec![2, 4, 6]);

fn copied<'a, T: 'a>(self) -> Copied<Self> where
    Self: InternalIterator<Item = &'a T>,
    T: Copy
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

let cloned = a.iter().into_internal().copied().collect::<Vec<_>>();

assert_eq!(cloned, vec![1, 2, 3]);

fn count(self) -> usize[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

assert_eq!(a.iter().into_internal().count(), 3);

fn enumerate(self) -> Enumerate<Self>[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = ['a', 'b', 'c'];

let enumerated = a.iter().into_internal().enumerate().collect::<Vec<_>>();

assert_eq!(enumerated, vec![(0, &'a'), (1, &'b'), (2, &'c')]);

fn filter<P>(self, predicate: P) -> Filter<Self, P> where
    P: FnMut(&Self::Item) -> bool
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [0i32, 1, 2];

let positive = a.iter().into_internal().filter(|x| x.is_positive()).collect::<Vec<_>>();

assert_eq!(positive, vec![&1, &2]);

fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F> where
    F: FnMut(Self::Item) -> Option<T>, 
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = ["1", "two", "NaN", "four", "5"];

let parsed: Vec<_> = a
    .iter()
    .into_internal()
    .filter_map(|x| x.parse::<i32>().ok())
    .collect();

assert_eq!(parsed, vec![1, 5]);

fn find<F>(self, f: F) -> Option<Self::Item> where
    F: FnMut(&Self::Item) -> bool
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

assert_eq!(a.iter().into_internal().find(|&&x| x == 2), Some(&2));

assert_eq!(a.iter().into_internal().find(|&&x| x == 5), None);

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, F> where
    F: FnMut(Self::Item) -> U,
    U: IntoInternalIterator
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

let mapped = a.iter()
    .into_internal()
    .flat_map(|&x| vec![x * 10 + 2, x * 10 + 3].into_iter().into_internal())
    .collect::<Vec<_>>();

assert_eq!(mapped, vec![12, 13, 22, 23, 32, 33]);

fn for_each<F>(self, f: F) where
    F: FnMut(Self::Item), 
[src]

fn inspect<F>(self, f: F) -> Inspect<Self, F> where
    F: FnMut(&Self::Item), 
[src]

fn last(self) -> Option<Self::Item>[src]

fn map<F, T>(self, f: F) -> Map<Self, F> where
    F: FnMut(Self::Item) -> T, 
[src]

use internal_iterator::{InternalIterator, IteratorExt};

let a = [1, 2, 3];

let doubled = a
    .iter()
    .into_internal()
    .map(|&x| x * 2)
    .collect::<Vec<_>>();

assert_eq!(doubled, vec![2, 4, 6]);

fn max(self) -> Option<Self::Item> where
    Self::Item: Ord
[src]

fn max_by<F>(self, compare: F) -> Option<Self::Item> where
    F: FnMut(&Self::Item, &Self::Item) -> Ordering
[src]

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item> where
    F: FnMut(&Self::Item) -> B,
    B: Ord
[src]

fn min(self) -> Option<Self::Item> where
    Self::Item: Ord
[src]

fn min_by<F>(self, compare: F) -> Option<Self::Item> where
    F: FnMut(&Self::Item, &Self::Item) -> Ordering
[src]

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item> where
    F: FnMut(&Self::Item) -> B,
    B: Ord
[src]

fn nth(self, n: usize) -> Option<Self::Item>[src]

fn partition<B, F>(self, f: F) -> (B, B) where
    F: FnMut(&Self::Item) -> bool,
    B: Default + Extend<Self::Item>, 
[src]

fn position<F>(self, f: F) -> Option<usize> where
    F: FnMut(Self::Item) -> bool
[src]

fn skip(self, n: usize) -> Skip<Self>[src]

fn take(self, n: usize) -> Take<Self>[src]

Loading content...

Implementors

impl<'a, I, T: 'a> InternalIterator for Cloned<I> where
    I: InternalIterator<Item = &'a T>,
    T: Clone
[src]

type Item = T

impl<'a, I, T: 'a> InternalIterator for Copied<I> where
    I: InternalIterator<Item = &'a T>,
    T: Copy
[src]

type Item = T

impl<A, B> InternalIterator for Chain<A, B> where
    A: InternalIterator,
    B: InternalIterator<Item = A::Item>, 
[src]

type Item = A::Item

impl<I> InternalIterator for Enumerate<I> where
    I: InternalIterator
[src]

type Item = (usize, I::Item)

impl<I> InternalIterator for Internal<I> where
    I: Iterator
[src]

type Item = I::Item

impl<I> InternalIterator for Skip<I> where
    I: InternalIterator
[src]

type Item = I::Item

impl<I> InternalIterator for Take<I> where
    I: InternalIterator
[src]

type Item = I::Item

impl<I, F> InternalIterator for Filter<I, F> where
    I: InternalIterator,
    F: FnMut(&I::Item) -> bool
[src]

type Item = I::Item

impl<I, F> InternalIterator for Inspect<I, F> where
    I: InternalIterator,
    F: FnMut(&I::Item), 
[src]

type Item = I::Item

impl<I, F, T> InternalIterator for FilterMap<I, F> where
    I: InternalIterator,
    F: FnMut(I::Item) -> Option<T>, 
[src]

type Item = T

impl<I, F, T> InternalIterator for Map<I, F> where
    I: InternalIterator,
    F: FnMut(I::Item) -> T, 
[src]

type Item = T

impl<I, F, T, U> InternalIterator for FlatMap<I, F> where
    I: InternalIterator,
    F: FnMut(I::Item) -> U,
    U: IntoInternalIterator<Item = T>, 
[src]

type Item = T

Loading content...