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

Implement #[derive(Query)] for enum types #384

Merged
merged 11 commits into from
Nov 20, 2024

Conversation

Moulberry
Copy link
Contributor

#[derive(Query)] can now be applied to enum types

An Enum query will yield the first variant that satisfies an Entity (even if there are other variants which might have satisfied it)
Supports tuple enums, struct enums and will ignore any unit enum field.

Closes #376

Copy link
Owner

@Ralith Ralith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great work!

macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
@Ralith
Copy link
Owner

Ralith commented Nov 19, 2024

Don't forget to update the rustdoc for derive_query in macros/src/lib.rs, also.

macros/src/lib.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
macros/src/query.rs Outdated Show resolved Hide resolved
tests/derive/enum_query.rs Outdated Show resolved Hide resolved
tests/derive/enum_unsupported.stderr Show resolved Hide resolved
@Ralith Ralith merged commit 96f8289 into Ralith:master Nov 20, 2024
5 checks passed
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.

OneOf Query Type
2 participants