Skip to main content

bon_sandbox/docs_comparison/
structs.rs

1/// Example docs generated with `bon`
2pub mod bon {
3    /// Doc comment on `Struct`
4    #[derive(bon::Builder)]
5    pub struct Struct {
6        /// Doc comment on `x1`
7        x1: u32,
8
9        /// Doc comment on `x2`
10        #[builder(default = 2 + 2)]
11        x2: u32,
12
13        /// Doc comment on `x3`
14        x3: Option<u32>,
15
16        /// Doc comment on `x4`
17        #[builder(into)]
18        x4: String,
19    }
20}
21
22/// Example docs generated with `buildstructor`
23pub mod buildstructor {
24    /// Doc comment on `Struct`
25    #[derive(buildstructor::Builder)]
26    pub struct Struct {
27        /// Doc comment on `x1`
28        x1: u32,
29
30        /// Doc comment on `x2`
31        x2: u32,
32
33        /// Doc comment on `x3`
34        x3: Option<u32>,
35
36        /// Doc comment on `x4`
37        x4: String,
38    }
39}
40
41/// Example docs generated with `typed-builder`
42pub mod typed_builder {
43
44    /// Doc comment on `Struct`
45    #[derive(typed_builder::TypedBuilder)]
46    #[builder(doc)]
47    pub struct Struct {
48        /// Doc comment on `x1`
49        x1: u32,
50
51        /// Doc comment on `x2`
52        #[builder(default = 2 + 2)]
53        x2: u32,
54
55        /// Doc comment on `x3`
56        #[builder(default)]
57        x3: Option<u32>,
58
59        /// Doc comment on `x4`
60        #[builder(setter(into))]
61        x4: String,
62    }
63}
64
65/// Example docs generated with `derive_builder`
66pub mod derive_builder {
67    /// Doc comment on `Struct`
68    #[derive(derive_builder::Builder)]
69    pub struct Struct {
70        /// Doc comment on `x1`
71        x1: u32,
72
73        /// Doc comment on `x2`
74        #[builder(default = 2 + 2)]
75        x2: u32,
76
77        /// Doc comment on `x3`
78        #[builder(default)]
79        x3: Option<u32>,
80
81        /// Doc comment on `x4`
82        #[builder(setter(into))]
83        x4: String,
84    }
85}