Overview
Make generated builder methods have source links that don't just go to the macro callsite.
Details
This feature request is similar to #57 and follows from #341.
#341 made it so that methods attached to some struct MyStruct, i.e. something along the lines of MyStruct::do_thing(..) -> MyStructDoThingBuilder<...> link to the original definition of MyStruct::do_thing instead of the macro callsite. This has not been implemented for methods on the builder, which is what this feature request covers. For example, consider
use bon::Builder;
#[derive(Builder)]
struct MyStruct {
property: i32,
}
The generated docs for MyStructBuilder::property(self, value: i32) -> MyStructBuilder<SetProperty<S>> link to the callsite line
instead of the line where property came from
. This issue is also present with params, with
#[bon]
impl MyStruct {
#[builder]
pub fn many_params(
a: i32,
b: i32,
c: i32
) -> i32 {
a + b + c
}
}
Generating a a(self, value: i32) -> ThingManyParamsBuilder<SetA<S>> which links to callsite
instead of the line where param a was defined
Examples
An example can be seen at https://docs.rs/remoteit-api/latest/remoteit_api/struct.R3ClientBuilder.html#method.credentials where clicking the "Source" links to https://docs.rs/remoteit-api/latest/src/remoteit_api/lib.rs.html#83 instead of https://docs.rs/remoteit-api/latest/src/remoteit_api/lib.rs.html#85.
Additional note
I'm not sure how easy or consistent implementing this will be. Based off implementing #341 it might be as easy as just keeping a span around, but I'm not sure given that we will need to traverse each parameter name and struct field to get the spans.
Overview
Make generated builder methods have source links that don't just go to the macro callsite.
Details
This feature request is similar to #57 and follows from #341.
#341 made it so that methods attached to some struct
MyStruct, i.e. something along the lines ofMyStruct::do_thing(..) -> MyStructDoThingBuilder<...>link to the original definition ofMyStruct::do_thinginstead of the macro callsite. This has not been implemented for methods on the builder, which is what this feature request covers. For example, considerThe generated docs for
MyStructBuilder::property(self, value: i32) -> MyStructBuilder<SetProperty<S>>link to the callsite line#[derive(Builder)]instead of the line where
propertycame from. This issue is also present with params, with
Generating a
a(self, value: i32) -> ThingManyParamsBuilder<SetA<S>>which links to callsite#[bon]instead of the line where param
awas definedExamples
An example can be seen at https://docs.rs/remoteit-api/latest/remoteit_api/struct.R3ClientBuilder.html#method.credentials where clicking the "Source" links to https://docs.rs/remoteit-api/latest/src/remoteit_api/lib.rs.html#83 instead of https://docs.rs/remoteit-api/latest/src/remoteit_api/lib.rs.html#85.
Additional note
I'm not sure how easy or consistent implementing this will be. Based off implementing #341 it might be as easy as just keeping a span around, but I'm not sure given that we will need to traverse each parameter name and struct field to get the spans.