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

Rename get/set functions #59

Open
tylerhawkes opened this issue Feb 25, 2020 · 1 comment
Open

Rename get/set functions #59

tylerhawkes opened this issue Feb 25, 2020 · 1 comment
Labels

Comments

@tylerhawkes
Copy link

I've been using getset on some configuration structs. I use it to derive almost all the getters, but I have some that are boolean and in the struct it makes sense to have them as enable_some_thing or allow_other_thing but when I use a function to query them it is more readable as some_thing_enabled or other_thing_allowed. I could just do the renaming through serde as a work around or just write the functions out like I've been doing instead of using getset but it would be nice to have the ability like serde to rename what is generated. It will probably require the current proc macro api annotations to change, but I think it would be quite useful.

@Boscop
Copy link
Collaborator

Boscop commented Jul 12, 2020

I agree, I found myself wishing for the ability to give getters a different name that makes more sense to the outside.

I think the syntax could be #[getset(get = "pub", name = "foo")].

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

No branches or pull requests

3 participants