Struct Touch

Source
pub struct Touch<I, F> { /* private fields */ }
Expand description

Trait Implementations§

Source§

impl<I, F> Iterator for Touch<I, F>
where I: Iterator, F: FnMut(&mut I::Item<'_>),

Source§

type Item<'a> = <I as Iterator>::Item<'a> where Self: 'a

The value yielded by each call to next on this iterator
Source§

fn next(&mut self) -> Option<Self::Item<'_>>

Get the next value of this iterator, or return None
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Get a hint as to the size of this iterator - the first value is a lower bound, second is an optional upper bound.
Source§

fn advance_by(&mut self, n: usize) -> Result<(), usize>

Advance the iterator by n elements
Source§

fn nth(&mut self, n: usize) -> Option<Self::Item<'_>>

Return the nth element of the iterator Read more
Source§

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

Take a closure which will take each value from the iterator, and yield a new value computed from it. Read more
Source§

fn touch<F>(self, f: F) -> Touch<Self, F>
where Self: Sized, F: FnMut(&mut Self::Item<'_>),

Gain mutable access to each value in this iterator, then yield it to the next step. This allows altering each item without consuming it, preserving the lending nature or the iterator
Source§

fn filter<F>(self, f: F) -> Filter<Self, F>
where Self: Sized, F: FnMut(&Self::Item<'_>) -> bool,

Execute a closure on each item in the iterator, returning true if it should be included, or false to skip it
Source§

fn step_by(self, step: usize) -> StepBy<Self>
where Self: Sized,

Creates an iterator starting at the same point, but stepping by the given amount at each iteration
Source§

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter>
where Self: Sized, U: IntoIterator, U::IntoIter: for<'a> Iterator<Item<'a> = Self::Item<'a>>,

Takes two iterators and creates a new iterator over both in sequence
Source§

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
where Self: Sized, U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates an iterator which gives the current iteration count as well as the next value
Source§

fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
where Self: Sized, F: FnMut(&Self::Item<'_>) -> bool,

Creates an iterator that skips elements based on a predicate
Source§

fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
where Self: Sized, F: FnMut(&Self::Item<'_>) -> bool,

Creates an iterator that yields elements based on a predicate
Source§

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Creates an iterator that skips the first n elements
Source§

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Creates an iterator that yields the first n elements, or fewer if the underlying iterator ends sooner
Source§

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

Tests if every element of the iterator matches a predicate
Source§

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

Tests if any element of the iterator matches a predicate
Source§

fn find<F>(&mut self, f: F) -> Option<Self::Item<'_>>
where F: FnMut(&Self::Item<'_>) -> bool,

Searches for an element of an iterator that satisfies a predicate
Source§

fn count(self) -> usize
where Self: Sized,

Consume the iterator, counting the number of items and returning it
Source§

fn for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Item<'_>),

Execute a closure on each value of this iterator
Source§

fn fold<T, F>(self, acc: T, f: F) -> T
where Self: Sized, F: FnMut(T, Self::Item<'_>) -> T,

Execute a closure on each value of this iterator, with an additional ‘accumulator’ value passed to each call. The closure is expected to return the new value of the accumulator.
Source§

fn scan<T, B, F>(self, acc: T, f: F) -> Scan<Self, T, F>
where Self: Sized, F: FnMut(&mut T, Self::Item<'_>) -> Option<B>,

Execute a closure on each value of this iterator, with an additional state value passed via mutable reference to each call. The closure is expected to return the new value for each step of the iterator, if the returned value is None the iterator stops early. Read more

Auto Trait Implementations§

§

impl<I, F> Freeze for Touch<I, F>
where I: Freeze, F: Freeze,

§

impl<I, F> RefUnwindSafe for Touch<I, F>

§

impl<I, F> Send for Touch<I, F>
where I: Send, F: Send,

§

impl<I, F> Sync for Touch<I, F>
where I: Sync, F: Sync,

§

impl<I, F> Unpin for Touch<I, F>
where I: Unpin, F: Unpin,

§

impl<I, F> UnwindSafe for Touch<I, F>
where I: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoIterator for T
where T: Iterator,

Source§

type IntoIter = T

The type of the returned iterator
Source§

fn into_iter(self) -> <T as IntoIterator>::IntoIter

Convert this value into an Iterator
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.