-
Notifications
You must be signed in to change notification settings - Fork 23
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
Writing multiple attributes in one line? #5
Comments
Yes I'd like this. :) |
According to The Reference Manual the grammer for attributes currently doesn't support We could work around this possibly by using something like I'm also not sure if the resulting API would be an improvement. I'm going to mark this |
I think it would be desirable to allow listing all getters/setters for a field in one line :) |
Yeah, I totally agree. Just need to think of the best way to do it! 🤔 |
Current proposal is a no goAccording to rust-lang/rust#55208, this is simple impossible since, even though attribute's syntax was relaxed a bit (a lot), it still requires attributes to correspond to this grammar:
In other words, the first path must be followed (optionally) by one of Alternative proposalSupport both forms: // old form
#[get]
#[set]
#[whatever]
// new form
#[getset(get, set, whatever)] It's pretty easy to disambiguate them, no breaking change is needed. Not to mention that almost every other derive macro out there uses To be clear, unlike #32 and #35 I'm not proposing to remove or deprecate old style attrs, I'm proposing to add a new alternative syntax. Before you ask, this won't complicate the code much, I am full of resolve to prove it :) I would be willing to send such a PR. |
@CreepySkeleton It sounds good to me. :) Please feel encouraged to open a PR, let me know if I can help with anything! |
@Hoverbear could you please review #47 and #48 first so I can stack the upcoming work on top of them? |
Yes just give me a day or so, travelling from China. :) |
@CreepySkeleton Those looked great. :) Thanks so much for the stuff so far! Sorry about the delays. |
It would be nice to be able to write multiple getset attributes in one line, to reduce verbosity, but when I do (e.g.
#[get = "pub", set = "pub"]
) the proc-macro panics..Can you make it work, please? :)
The text was updated successfully, but these errors were encountered: