diff options
| author | Mica White <botahamec@outlook.com> | 2026-06-07 07:16:55 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-06-07 07:16:55 -0400 |
| commit | d555b1e96770406cbf3a7d8aeb56785dfb7ab8d4 (patch) | |
| tree | 620e75c9f68dfd9d62dc73ef00ddec1605f7ca48 /src/lib.rs | |
| parent | 67fc414e1e490da951bd0fd037f8ad179a0c0824 (diff) | |
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -163,6 +163,8 @@ pub fn derive_builder(input: TokenStream) -> TokenStream { .ok() .flatten() .or_else(|| { + // a normal struct can be constructed if all of the fields are public, so + // it makes sense to also allow a builder in this case. fields .iter() .all(|field| matches!(field.visibility, Visibility::Public(_))) @@ -258,10 +260,12 @@ pub fn derive_builder(input: TokenStream) -> TokenStream { }); quote! { + #[doc(hidden)] #builder_visibility struct #builder_name<#(const #const_generics: bool),*> { #(#field_names: Option<#field_types>,)* } + // using impl instead of derive to improve compilation time impl<#(const #const_generics: bool),*> core::default::Default for #builder_name<#(#const_generics),*> { fn default() -> Self { Self { |
