summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0289b15..55b2b5b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 {