You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thank you for creating and maintaining Bon—it’s been a pleasure working with it!
As I migrate a codebase to Bon, I’ve run into a challenge with the naming conventions for setters handling Option fields. My current codebase uses set_ as the prefix for these setters. While Bon's built-in support for Option setters is a fantastic feature that removes the need for manual definitions, it uses the maybe_ prefix by default.
This mismatch means I still have to manually rename every setter to match my convention, which undermines some of the convenience.
I’d like to suggest two potential improvements to make this process smoother for me and other users:
Introduce configurability for setter prefixes at the type level:
Allowing users to define their preferred prefix (e.g., set_, maybe_, or custom ones) would offer greater flexibility and make Bon more adaptable to different codebases and conventions.
While either of the suggested changes would address my use case, I believe adding the ability to configure this at the type level would provide greater flexibility and cover a wider range of use cases.
Code snippet:
#[derive(Builder)]#[builder(on(optional, prefix = "set_"))]// Example syntax for explanation, not necessarily the suggested approachstructFoo{value:Option<String>,label:Option<String>,}
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.
Hi there,
First off, thank you for creating and maintaining Bon—it’s been a pleasure working with it!
As I migrate a codebase to Bon, I’ve run into a challenge with the naming conventions for setters handling
Optionfields. My current codebase usesset_as the prefix for these setters. While Bon's built-in support forOptionsetters is a fantastic feature that removes the need for manual definitions, it uses themaybe_prefix by default.This mismatch means I still have to manually rename every setter to match my convention, which undermines some of the convenience.
I’d like to suggest two potential improvements to make this process smoother for me and other users:
set_as the default prefix forOptionsetters (this align with naming in Introduce bool shorthand (#[builder(flag)]) #142)Allowing users to define their preferred prefix (e.g.,
set_,maybe_, or custom ones) would offer greater flexibility and make Bon more adaptable to different codebases and conventions.While either of the suggested changes would address my use case, I believe adding the ability to configure this at the type level would provide greater flexibility and cover a wider range of use cases.
Code snippet:
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.