bon
bon copied to clipboard
Add attributes to override doc comments for every component of the generated code
The motivation for this feature is this reddit comment.
I propose the following attributes design:
Structs
/// Struct docs (not copied anywhere)
#[derive(bon::Builder)]
#[builder(
builder_type(docs(
/// Builder type docs
)),
start_fn(docs(
/// Starting function docs
)),
finish_fn(docs(
/// Finishing function docs
))
)]
struct Example {
/// Field docs (inherited by setter by default)
#[builder(docs(
/// Setter docs override
))]
field: i32,
}
Functions
/// Start fn docs
#[builder(
builder_type(docs(
/// Builder type docs
)),
finish_fn(docs(
/// Finishing function docs
))
)]
fn example(
/// Setter docs (always moved to the setter).
/// Rust doesn't support docs on arguments directly otherwise
arg: u32
) {}
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.