tuple_for_each
Provides macros and methods to iterate over the fields of a tuple struct.
Added methods:
is_empty() -> bool
: Whether the tuple has no field.len() -> usize
: Number of items in the tuple.
Generated macros:
<tuple_name>_for_each!(x in tuple { ... })
<tuple_name>_enumerate!((i, x) in tuple { ... })
Examples
use TupleForEach;
;
let tup = FooBar;
assert!;
assert_eq!;
// prints "23", "hello", "true" line by line
foo_bar_for_each!;
// prints "0: 23", "1: hello", "2: true" line by line
foo_bar_enumerate!;