bon
bon copied to clipboard
Introduce `#[derive(Setters, Getters)]` to derive simple accessor methods
This is based on feature requests #24 and #69.
Once we have a feature-complete builder derive we may add a feature to derive the getter/setter methods directly on the structs/enums.
This will effectively be our wheel that reimplements the features from the getset crate and other alternative crates derive_getters, derive_setters.
Note that I'm not yet ready to invest effort into the design of this feature yet. It requires studying the prior art of the getset crate first and then determining how this can be integrated into bon, how this may interact with the builder feature etc. It's a big design effort, that I'd rather postpone to the time when the builder derives/macros are feature complete.
A note for the community from the maintainers
Please vote on this issue by adding a 👍 reaction to help the maintainers with prioritizing it. You may add a comment describing your real use case related to this issue for us to better understand the problem domain.
Where should we place feature requests, here or on #251 ? We'd like to override bon's getter name default away from get_() to adhere to https://rust-lang.github.io/api-guidelines/naming.html#getter-names-follow-rust-convention-c-getter - however currently this looks like it requires every line to then duplicate the attribute name with name=field?
There is an issue about doing prefix overrides at the top level: https://github.com/elastio/bon/issues/230