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

Make it work for tuples of iterators? #106

Open
Boscop opened this issue Aug 5, 2020 · 4 comments
Open

Make it work for tuples of iterators? #106

Boscop opened this issue Aug 5, 2020 · 4 comments
Labels
A-auto_enum Area: #[auto_enum] C-enhancement Category: A new feature or an improvement for an existing one

Comments

@Boscop
Copy link

Boscop commented Aug 5, 2020

Would it be possible to support tuples of iterators? (Basically doing it per tuple component.)
So that this would work:

image

@taiki-e
Copy link
Owner

taiki-e commented Aug 12, 2020

How does this work if the trait implemented for tuples?

@Boscop
Copy link
Author

Boscop commented Aug 13, 2020

It would work per tuple constituent, for tuples where all constituents impl Iterator (considering that the proc-macro can't check the types of the constituent, it's ok to assume they impl Iterator).

@taiki-e
Copy link
Owner

taiki-e commented Aug 14, 2020

Oh, sorry, I misunderstood that I could implement foreign traits for tuples.

@taiki-e
Copy link
Owner

taiki-e commented Aug 14, 2020

Ok, I think we can support this based on the rules like the following:

  • Traits are defined in the standard library and not implemented for tuples.
  • All branches are considered to return tuples if at least one branch uses tuple syntax.

What is not clear yet is:

  • Should macro generates enums per each tuple element or a single enum for all tuple elements? (i.e., return (EnumA, EnumB,) or return (EnumA, EnumA,))
  • How do the above rules apply when multiple traits are specified?
  • Should support complex syntax? (e.g., nested tuples)

@taiki-e taiki-e added A-auto_enum Area: #[auto_enum] C-enhancement Category: A new feature or an improvement for an existing one labels Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto_enum Area: #[auto_enum] C-enhancement Category: A new feature or an improvement for an existing one
Projects
None yet
Development

No branches or pull requests

2 participants