Closed bobbbay closed 2 years ago
There's not support for changing the documentation through the macro, but it's trivial to create the effect you're looking for:
#[builder(build_fn(private, name = "build_internal"))]
to your struct so that derive_builder
generates a build method for you but doesn't expose it externally.build
method that has the same signature as build_internal
There's no reason we couldn't add a macro option for this, but it would need to be written inside quotation marks so the authoring experience would be pretty rough. For that reason, I'm inclined to think this approach of wrapping the build method is probably the better solution long-term, even if it is more code.
Yeah, I'm good with that solution. It's not too overcomplicated, and makes sense. Thank you!
Currently, the
XBuilder::build
documentation is generated as follows:Builds a new X.
Errors
If a required field has not been initialized.
Is it possible to customize this documentation? For instance, I have a custom validation function that can fail for different reasons. I would like to mention that in my documentation.