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

Add #[darling(word)] for enum variants #63

Closed
TedDriggs opened this issue Feb 12, 2019 · 4 comments
Closed

Add #[darling(word)] for enum variants #63

TedDriggs opened this issue Feb 12, 2019 · 4 comments

Comments

@TedDriggs
Copy link
Owner

DefaultExpression is one example of an enum that wants to map a specific variant to the appearance of the field ident with no associated value. This would only be valid on variants in FromMeta. The variant must be a unit variant.

@TedDriggs
Copy link
Owner Author

@chipsenkbeil I think this is what you're looking for ent(field)

@chipsenkbeil
Copy link
Contributor

In my case, I'm looking for a word or a list as the attribute can be #[ent(field)] if just marking a struct field as an entity field, or something like #[ent(field(indexed, mutable))] if marking as an entity field with special flags.

Separately, I also have #[ent(edge)] that can have #[ent(edge(type = "some::type", policy = "SomeEnumVariant"))].

To summarize, I'm both looking for the presence of field or edge as a boolean indicator as well as optional inner words/named values to assign other properties. All of the inner content comes across as optional, with words defaulting to false as booleans and types defaulting to None/a default value.

@TedDriggs
Copy link
Owner Author

TedDriggs commented Jan 5, 2021

Check out darling::util::Override. The naming isn't the most obvious for your use-case, but I believe it does what you're looking for if you use Option<Override<EdgeOpts>>.

@TedDriggs
Copy link
Owner Author

Given the existence of the above workaround (and the lack of movement for almost 3 years), I'm closing this as "Won't Fix."

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

No branches or pull requests

2 participants