[−][src]Macro monadic::monadic
converting monadic blocs of IntoIterator's as monads à la Haskell
You can use:
Option::pure( return_expresion)
to return an expression valuev <- monadic_expression
to use the monad result_ <- monadic_expression
to ignore the monad resultlet z = expression
to combine monad resultsguard boolean_expression
to filter results
it uses into_iter().flat_map
instead of the defined bind
for wider applicability since the latter requires the Sized constraint
There are transitive implementation relations for some structures to be instances of IntoIterator:
Some structures e.g. Range
implement a supertrait of Iterator, which in turn implements IntoIterator
impl<I: Iterator> IntoIterator for I
∀ I:Iterator,
as documented
Iterator and IntoIterator imports are predefined