Title: Theory / Unimportant / CS / Programming / Rust / Library / Iter
Tags: automatedNewLineAfterCommaSpace
On every note of this deck, unless a note says otherwise:
Page: https://doc.rust-lang.org/std/iter/index.html
Page: https://doc.rust-lang.org/std/iter/index.html

Instruction: for x in iter {
  e
}
Page: https://doc.rust-lang.org/book/ch03-05-control-flow.html
Effect: Evaluate e for each element returned by iter, with x replaced by the element of iter.into_iter(). Consumes iter
Language: Rust
Chapter: 3
Variables: e: expression

Instruction: a.iter()
Page: https://doc.rust-lang.org/book/ch03-05-control-flow.html
Language: Rust
Chapter: 3
Returns: An iterator, consumming a, returning each element of a
Variables: a an iterable

Instruction: (i..j)
Page: https://doc.rust-lang.org/book/ch03-05-control-flow.html
Language: Rust
Chapter: 3
Returns: n iterator returning each integers between i and j
Variables: a an array

Instruction: a.into_iter()
Page: https://doc.rust-lang.org/book/ch10-02-traits.html
Language: Rust
Chapter: 10
Returns: An iterator returning each element of a, consuming a
Variables: a an iterable

Instruction: a.iter_mut()
Page: https://doc.rust-lang.org/book/ch10-02-traits.html
Language: Rust
Chapter: 10
Returns: An iterator returning mutable element of a.
Variables: a an iterable

Instruction: iter.sum()
Page: https://doc.rust-lang.org/book/ch10-02-traits.html
Effect: Consumes iter
Language: Rust
Chapter: 10
Returns: The sum of elements returned by the iterator
Variables: iter: Iterator of summable
iter: Sum

Name: An iterator adaptor
Definition: A function from iterator to iterator
Page: https://doc.rust-lang.org/book/ch13-02-iterators.html
Chapter: 13
Context: Rust
Example: map
Example2: filter

Instruction: iter.map(f)
Page: https://doc.rust-lang.org/book/ch13-02-iterators.html
Chapter: 13
Returns: Iterator whose i-th element is f(x_i), with x_i the i-th element returned by iter
Variables: iter an iterator<T>
f : T -> U

Instruction: iter.collect()
Page: https://doc.rust-lang.org/book/ch13-02-iterators.html
Chapter: 13
Returns: A collection containing all elements returned by iter
Variables: iter an iterator<T>

Instruction: iter.filter(prop)
Page: https://doc.rust-lang.org/book/ch13-02-iterators.html
Chapter: 13
Returns: An iterator that returns all elements satisfying prop
Variables: iter an iterator<T>
prop: T->bool

Instruction: iter.skip(n)
Page: https://doc.rust-lang.org/book/ch13-02-iterators.html
Chapter: 13
Returns: An iterator returning all elements after the n-th one of iter
Variables: iter an iterator<T>
n int

Instruction: iter_1.zip(iter_2)
Page: https://doc.rust-lang.org/book/ch13-02-iterators.html
Chapter: 13
Returns: An iterator<(T_1,T_2)>  with the pair of elements of iter_1 and iter_2,
Variables: iter_i an iterator<T_i>

Typ: Iterator
Meaning: A data structure allowing to iterate over its content by shared reference
Function: fn next(&mut self) -> Option<Self::Item>

Instruction: iter.next()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: A next element not returned or None
Variables: iter: Iterator

Smaller0: C provides iter()
Greater0: C provides IntoIterator for &C
Page: https://doc.rust-lang.org/std/iter/index.html
Variables: C a collection type
Intuition: Evaluate e for each element returned by iter, with x replaced by the element of iter

Smaller0: C provides iter_mut()
Greater0: C provides IntoIterator for &mut C
Page: https://doc.rust-lang.org/std/iter/index.html
Variables: C a collection type

Instruction: iter.for_each(fn)
Page: https://doc.rust-lang.org/std/iter/index.html
Effect: Call fn to each element returned by iter. Consumes it.
Variables: iter: Iterator

Instruction: n..
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator starting at n and returning all elements greater
Variables: iter: Iterator

Instruction: iter.take(n)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator that halts after the n-th first elements
Variables: iter: Iterator

Instruction: iter.size_hint()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: lower bound, and optional upper bound, of the number of remaining elements
Variables: iter: Iterator

Instruction: iter.count()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: Number of elements remaining in the iterator
Variables: iter: Iterator
Extra: Consume the list

Instruction: iter.last()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: Last element in the iterator or None
Variables: iter: Iterator
Extra: Consume the list

Instruction: iter.nth(n)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: the n-th element of iter, or None
Variables: iter: Iterator

Instruction: iter.step_by(step)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: A iterator returning the first element and every step- elements
Variables: iter: Iterator

Instruction: iter.chain(other)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: A iterator returning iter then other's element
Variables: iter: Iterator

Instruction: iter.zip(other)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: A iterator returning pair of elements of iter and other, up until one returns None
Variables: iter: Iterator

Instruction: iter.filter_map(fn)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator over Some values returned by fn(iterated), with iterated returned by iter
Variables: iter: Iterator

Instruction: iter.enumerate()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An enurator of (i, ith_value) for ith_value emitted by iter
Variables: iter: Iterator

Instruction: iter.peekable()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: A peekable iterator over the same content
Variables: iter: Iterator

Instruction: iter.skip_while(pred)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: an iterator that skips elements based on a predicate.
Variables: iter: Iterator

Typ: std::iter::Chain<A, B>
Meaning: Iterator emitting elements of A then of B
Variables: iter: Iterator

Typ: std::iter::Cloned<I>
Meaning: An iterator that clones the elements of an underlying iterator.
Variables: iter: Iterator

Typ: std::iter::Copied<I>
Meaning: An iterator that copies the elements of an underlying iterator.

Typ: std::iter::Cycle<I>
Meaning: An iterator that repeats endlessly

Typ: std::iter::Empty<T>
Meaning: An empty iterator

Typ: std::iter::Enumerate<T>
Meaning: An iterator that yields the current count and the element during iteration.
Subtype of: Iterator<( usize, <I as Iterator>::Item )>

Typ: std::iter::Filter<I, P>
Meaning: An iterator that filters the elements of iter with predicate.
Subtype of: Iterator<I>

Typ: std::iter::FilterMap<I, P>
Meaning: An iterator that uses f to both filter and map elements from iter.
Subtype of: Iterator<I>

Typ: std::iter::FlatMap<I, U, F>
Meaning: An iterator that maps each element to an iterator, and yields the elements of the produced iterators.
Subtype of: Iterator<I>

Typ: std::iter::Flatten<I>
Meaning: An iterator that flattens one level of nesting in an iterator of things that can be turned into iterators.
Subtype of: Iterator<I>

Typ: std::iter::FromFn<F>
Meaning: An iterator where each iteration calls the provided closure F: FnMut() -> Option<T>.

Typ: std::iter::Fuse<I>
Meaning: An iterator that yields None forever after the underlying iterator yields None once.
Subtype of: Iterator<I>

Typ: std::iter::Inspect<I, F>
Meaning: An iterator that calls a function with a reference to each element before yielding it.
Subtype of: Iterator<I>

Typ: std::iter::Map<I, F>
Meaning: An iterator that maps the values of iter with f.
Subtype of: Iterator<I>

Typ: std::iter::MapWhile<I, P>
Meaning: An iterator that only accepts elements while predicate returns Some(_).
Subtype of: Iterator<I>

Typ: std::iter::Once<T>
Meaning: An iterator that yields an element exactly once.
Subtype of: Iterator<T>

Typ: std::iter::OnceWith<F>
Meaning: An iterator that yields a single element of type A by applying the provided closure F: FnOnce() -> A.
Subtype of: Iterator<A>

Typ: std::iter::Peekable<I>
Meaning: An iterator with a peek() that returns an optional reference to the next element.
Subtype of: Iterator<I>

Instruction: peekable.peek()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: Reference to the next value that next() would return, or None
Variables: peekable: std::iter::Peekable<I>

Instruction: peekable.peek_mut()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: Mutable reference to the next value that next() would return, or None
Variables: peekable: std::iter::Peekable<I>

Instruction: peekable.next_if(func)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: the next value of this iterator if a condition func(value) is true. Else None
Variables: peekable: std::iter::Peekable<I>

Instruction: peekable.next_if_eq(expected)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: the next value of this iterator if it is equal to expected. Else None
Variables: peekable: std::iter::Peekable<I>

Typ: std::iter::Repeat<A>
Meaning: An iterator that repeats an element endlessly.
Subtype of: Iterator<A>

Typ: std::iter::RepeatWith<F>
Meaning: An iterator that repeats elements of type A endlessly by applying the provided closure F: FnMut() -> A.
Subtype of: Iterator<A>

Typ: std::iter::Rev<T>
Meaning: A double-ended iterator with the direction inverted.
Subtype of: Iterator<T>

Typ: std::iter::Scan<I, St, F>
Meaning: An iterator to maintain state while iterating another iterator.
Subtype of: Iterator<T>

Typ: std::iter::Skip<I>
Meaning: An iterator that skips over n elements of iter.
Subtype of: Iterator<I>

Typ: std::iter::SkipWhile<I, P>
Meaning: An iterator that rejects elements while predicate returns true.
Subtype of: Iterator<I>

Typ: std::iter::StepBy<I>
Meaning: An iterator for stepping iterators by a custom amount.
Subtype of: Iterator<I>

Typ: std::iter::Successors<T, F>
Meaning: An new iterator where each successive item is computed based on the preceding one.
Subtype of: Iterator<I>

Typ: std::iter::Take<I>
Meaning: An iterator that only iterates over the first n iterations of iter.
Subtype of: Iterator<I>

Typ: std::iter::TakeWhile<I, P>
Meaning: An iterator that only accepts elements while predicate returns true.
Subtype of: Iterator<I>

Typ: std::iter::Zip<A, B>
Meaning: An iterator that iterates two other iterators simultaneously.
Subtype of: Iterator<I>

Typ: std::iter::Sum<A = Self>
Meaning: Trait to represent types that can be created by summing up an iterator.

Typ: std::iter::Product<A = Self>
Meaning: Trait to represent types that can be created by pmultiplying elements of an iterator.

Instruction: prod.product()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: The products of elements of prod
Variables: prod: std::iter::Product<A = Self>

Instruction: iter::empty::<T>();
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An empty iterator of type T

Instruction: iter::from_fn(fn)
iter::repeat_with(fn)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator that uses fn to emit each elements

Instruction: iter::once(value);
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator that emit value and halts

Instruction: iter::once_with(fn);
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator that emit fn() and halts

Instruction: iter::repeat(value);
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator that emit value infinitely often

Instruction: iter::successors(
  first,
  succ
);
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An iterator that emit first then succ(  last_value_returned)

Typ: std::iter::FusedIterator<I>
Meaning: An iterator that always continues to yield None when exhausted.

Typ: std::iter::IntoIterator
Meaning: Can be used in a for, emitting values of type Self::Item

Typ: IntoIter::Item
Meaning: The type of the elements being iterated over.
Variables: IntoIter : IntoIterator

Typ: IntoIterable::Iterator
Meaning: Which kind of iterator are we turning this into?
Variables: IntoIterable : IntoIterator

Typ: std::iter::FromIterator
Meaning: By implementing FromIterator for a type, you define how it will be created from an iterator. This is common for types which describe a collection of some kind.

Instruction: C::from_iter(iter)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: A value of type C, with content of the iter
Variables: iter : IntoIterator<Item = A>

Instruction: col.extend(iter)
Page: https://doc.rust-lang.org/std/iter/index.html
Effect: Add elements emitted by iter to col
Variables: col: std::iter::Extend

Instruction: col.extend_one(value)
Page: https://doc.rust-lang.org/std/iter/index.html
Effect: add value to col
Variables: col: std::iter::Extend

Instruction: col.extend_reserve(additional)
Page: https://doc.rust-lang.org/std/iter/index.html
Effect: adapt the collection so that it can efficiently host additional elements
Variables: col: std::iter::Extend

Typ: std::iter::EXtend
Meaning: Extend a collection with the contents of an iterator.
Variables: col: std::iter::Extend

Typ: std::iter::ExactSizeIterator
Meaning: An iterator that knows its exact length.
Variables: col: std::iter::Extend

Instruction: iter.len()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: Number of elements remaining in the iterator
Variables: iter: std::iter::ExactSizeIterator

Instruction: iter.is_empty()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: Whether there remains no element in the iterator
Variables: iter: std::iter::ExactSizeIterator

Typ: DoubleEndedIterator
Meaning: An iterator able to yield elements from both ends.
Function: fn next_back(&mut self) -> Option<Self::Item>
Extends: Iterator
Variables: iter: std::iter::ExactSizeIterator

Typ: DoubleEndedIterator
Function: fn next_back(&mut self) -> Option<Self::Item>
Variables: iter: std::iter::ExactSizeIterator

Instruction: double_iterator.next_back()
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: An element from the back of the iterator if any remains, or None
Variables: double_iterator: DoubleEndedIterator

Instruction: double_iterator.nth_back(n)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: The n-th element from the back of the iterator, or None
Variables: double_iterator: DoubleEndedIterator

Instruction: double_iterator.rfold(
  init,
  fn
)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: fn(  ...(  fn(  init, last_elt), ...), elt_0)
Variables: double_iterator: DoubleEndedIterator

Instruction: double_iterator.rfind(pred)
Page: https://doc.rust-lang.org/std/iter/index.html
Returns: The last most element satisfiying pred or None
Variables: double_iterator: DoubleEndedIterator

Typ: IntoIterator
Meaning: Type that can be transformed into an iterator
Function: into_iter() -> Self::IntoIter
Variables: double_iterator: DoubleEndedIterator