getset icon indicating copy to clipboard operation
getset copied to clipboard

Rename get/set functions

Open tylerhawkes opened this issue 4 years ago • 1 comments

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.

tylerhawkes avatar Feb 25 '20 22:02 tylerhawkes

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")].

Boscop avatar Jul 12 '20 02:07 Boscop