diff options
Diffstat (limited to 'src')
| -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 { |
