Skip to main content

bon_sandbox/docs_comparison/
methods.rs

1/// Example docs generated with `bon`
2pub mod bon {
3    /// Doc comment on `Struct`
4    pub struct Struct;
5
6    #[bon::bon]
7    impl Struct {
8        /// Doc comment on `method`
9        #[builder]
10        pub fn method(
11            &self,
12
13            /// Doc comment on `x1`
14            x1: u32,
15
16            /// Doc comment on `x2`
17            #[builder(default = 2 + 2)]
18            x2: u32,
19
20            /// Doc comment on `x3`
21            x3: Option<u32>,
22
23            /// Doc comment on `x4`
24            #[builder(into)]
25            x4: String,
26        ) {
27        }
28    }
29}
30
31/// Example docs generated with `buildstructor`
32// This lint comes from buildstructor-generated code
33#[expect(elided_lifetimes_in_paths)]
34// This lint comes from nightly
35#[allow(unknown_lints, mismatched_lifetime_syntaxes)]
36pub mod buildstructor {
37
38    /// Doc comment on `Struct`
39    pub struct Struct;
40
41    #[buildstructor::buildstructor]
42    impl Struct {
43        /// Doc comment on `method_orig`
44        #[builder(entry = "method")]
45        pub fn method_orig(&self, x1: u32, x2: u32, x3: Option<u32>, x4: String) {}
46    }
47}