Remove need for tuple_for_each!
, tuple_len!
and simplify gen_conditions!
a lot
#99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By using named fields instead of anonymous one in the
$mod_name::Streams
structs, we can completelyremove the need for the very
tuple_for_each!
macros, which makes the code more maintainable andthe crate faster to compile (though that wasn't a limitation at this point).
I also took the opportunity to remove the
tuple_len!
macro because recursivity is heavy on the compiler. The generated code for this part doesn't slow down at all because it's all const-computed anyway (but instead of producing an imbalanced binary tree, we produce a more "normal" one which is much easier to deal with forrustc
).Finally, I greatly simplified the
gen_conditions!
macro by removing the recursion by using theIndexes
enum again (that trick is awesome, I'm glad I finally found a crate to share it with 😄), which (again) removes a very unbalanced tree of0 + 1 + 1 + 1 + ...
in the generated code.