Module rust_examples::collect[][src]

Expand description

This module includes Rust’s implementation of traversable types.

Traverse is a type class which threats an effect through a collection (or another wrapping context) and “turns the effect inside out”.

Rust implements pattern via combination of map (to apply the effect) followed by collect which is available for std::iter::FromIterator instances (in Scala Cats this is referred to as sequence).

Functions

Traverse a collection of input values and apply an effect to item that may fail (take the first character from each string slice, resulting in an Option<char>).

Traversing a Result works analogously to an Option since a result is basically an option where the None case is some more specific type.