I noticed that the builder has support for explicitly provided comments, e.g. via
#[builder(
default,
setter(strip_option, doc = "Set `y`. If you don't specify a value it'll default to no value.",)
)]
However, regular doccomments would be ignored even when no setter-specific doc attribute is provided. With this PR, the following is now possible:
struct Foo {
/// `x` value.
///
/// This field is mandatory.
x: i32,
/// This doccomment is ignored for the setter.
#[builder(
default,
setter(strip_option, doc = "Set `y`. If you don't specify a value it'll default to no value.",)
)]
y: Option<i32>,
#[builder(default = 20)]
z: i32,
}
On the builder, x(...) will be documented with the regular doccomment, y(...) is documented with the setter attribute as before and z(...) remains undocumented, as before.
When the builder emits deprecated functions, they also inherit the documentation. This was not previously the case.
I noticed that the builder has support for explicitly provided comments, e.g. via
However, regular doccomments would be ignored even when no setter-specific
doc
attribute is provided. With this PR, the following is now possible:On the builder,
x(...)
will be documented with the regular doccomment,y(...)
is documented with the setter attribute as before andz(...)
remains undocumented, as before.When the builder emits
deprecated
functions, they also inherit the documentation. This was not previously the case.