Support shared #[builder]
configuration in #[bon]
macro at the impl
block level
#144
Labels
feature request
A new feature is requested
In some cases, developers would like to share the
#[builder(...)]
configuration across all their methods in the impl block, or even across all impl blocks.Today, the users of
bon
need to copy-paste the same builder configs across all methods inside of theimpl
block manually, which isn't convenient when the number of methods is big and growing.The proposed syntax is the following:
This way the developers can move their configs to the top of the impl block to prevent code duplication at the entire impl block level. If the developers want to share these configs between multiple
impl
blocks they can easily create an attribute alias withmacro_rules_attribute::attribute_alias
.Once we have this feature, the documentation for the "Shared Configuration" pattern needs to be updated to propose a solution for sharing configs for associated methods using the new syntax.
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.
The text was updated successfully, but these errors were encountered: