[][src]Trait makepad_internal_iter::InternalIterator

pub trait InternalIterator {
    type Item;
    fn for_each<F>(self, f: &mut F) -> bool
    where
        F: FnMut(Self::Item) -> bool
; fn collect<F>(self) -> F
    where
        Self: Sized,
        F: FromInternalIterator<Self::Item>
, { ... }
fn map<R, F>(self, f: F) -> Map<Self, F>
    where
        Self: Sized,
        F: FnMut(Self::Item) -> R
, { ... } }

A trait for internal iterators. An internal iterator differs from a normal iterator in that its iteration is controlled internally by the iterator itself, instead of externally by the calling code. This means that instead of returning a single item on each call to next, internal iterators call a closure for each item on a single call to for_each. This allows internal operators to be implemented recursively, something that is not possible with normal iterators.

Associated Types

type Item

Loading content...

Required methods

fn for_each<F>(self, f: &mut F) -> bool where
    F: FnMut(Self::Item) -> bool

Calls f with each item of self.

If f returns false, iteration is aborted. If iteration was aborted, this function returns false.

Loading content...

Provided methods

fn collect<F>(self) -> F where
    Self: Sized,
    F: FromInternalIterator<Self::Item>, 

Transforms self into a collection.

fn map<R, F>(self, f: F) -> Map<Self, F> where
    Self: Sized,
    F: FnMut(Self::Item) -> R, 

Returns an internal iterator that applies f to each item of self.

Loading content...

Implementors

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

type Item = I::Item

Loading content...