Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use macro loops to implement traits #1

Merged
merged 4 commits into from
Nov 23, 2018
Merged

Conversation

phimuemue
Copy link

@phimuemue phimuemue commented Apr 15, 2018

I saw the comment at https://github.com/csherratt/tuple_utils/blob/master/src/lib.rs#L129 and thought that we could replace all those manual impls with ones created by macro loops.

Basically, I delegated the work to two macros:

  • Essentailly, for_each_prefix takes a macro and a list of arguments and applies the macro to all prefixes of the argument list.
  • for_each_prefix_suffix does something similar, but applies the given macro to the suffixes, too.

For simplicity, I always used trailing commas in the macros. In addition, I replaced type names A, B, C... with T0, T1, T2....

@csherratt csherratt merged commit 65dcac7 into csherratt:master Nov 23, 2018
@csherratt
Copy link
Owner

Thanks! Sorry I missed this pull request and let it sit for so long. It's appreciated.

@phimuemue
Copy link
Author

No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants