nested_iter_yield

Macro nested_iter_yield 

Source
nested_iter_yield!() { /* proc-macro */ }
Expand description

Creates an n-nested for loop of iterators over the passed input. Assumes that the first argument can be called multiple times to produce identical iterators.

§Usage

§Basic syntax

nested_iter_yield!(iterable_name, 3)

§Dereference values from vector iterable

nested_iter_yield!(vector_name.iter(), 3, *)

The third argument is optional. Here * is prefixed to each result of the iterator. Any value passed as the third argument that does not begin with a . will be prefixed to each result of the iterator.

§Clone values from vector iterable

nested_iter_yield!(vector_name.iter(), 3, .clone())

Here .clone() is appended to each result of the iterator. Any value that begins with . will be treated as a postfix.

§Prefix genawaiter exports

When the source library does not have genawaiter as a dependency, e.g. because this helper macro is being used in a library, it is sometimes necessary to prefix the reference to genawaiter. This is done with a fourth argument, as such:

nested_iter_yield!(vector_name.iter(), 3, .to_owned(), package_name::)