fn compute_impl_bounds(&self) -> syn::Generics {
        if let Some(type_gen) = self.generics {
            let mut generics = type_gen.clone();

            if !self.pattern.requires_clone() || type_gen.type_params().next().is_none() {
                return generics;
            }

            let clone_bound = TypeParamBound::Trait(TraitBound {
                paren_token: None,
                modifier: TraitBoundModifier::None,
                lifetimes: None,
                path: syn::parse_str("::derive_builder::export::core::clone::Clone").unwrap(),
            });

            for typ in generics.type_params_mut() {
                typ.bounds.push(clone_bound.clone());
            }

            generics
        } else {
            Default::default()
        }
    }
/// Add `Clone` trait bound to generic types for non-owned builders.
/// This enables target types to declare generics without requiring a
/// `Clone` impl. This is the same as how the built-in derives for
/// `Clone`, `Default`, `PartialEq`, and other traits work.
Add `Clone` trait bound to generic types for non-owned builders.
This enables target types to declare generics without requiring a
`Clone` impl.
Add ` Clone ` trait bound to generic types for non - owned builders . This enables target types to declare generics without requiring a ` Clone ` impl .
fn compute_impl_bounds(&self) -> syn::Generics {
        if let Some(type_gen) = self.generics {
            let mut generics = type_gen.clone();
            if !self.pattern.requires_clone() || type_gen.type_params().next().is_none() {
                return generics;
            }
            let clone_bound = TypeParamBound::Trait(TraitBound {
                paren_token: None,
                modifier: TraitBoundModifier::None,
                lifetimes: None,
                path: syn::parse_str("::derive_builder::export::core::clone::Clone").unwrap(),
            });
            for typ in generics.type_params_mut() {
                typ.bounds.push(clone_bound.clone());
            }
            generics
        } else {
            Default::default()
        }
    }
fn compute_impl_bounds ( & self ) -> syn :: Generics { if let Some ( type_gen ) = self . generics { let mut generics = type_gen . clone ( ) ; if ! self . pattern . requires_clone ( ) || type_gen . type_params ( ) . next ( ) . is_none ( ) { return generics ; } let clone_bound = TypeParamBound :: Trait ( TraitBound { paren_token : None , modifier : TraitBoundModifier :: None , lifetimes : None , path : syn :: parse_str ( " " ) . unwrap ( ) , } ) ; for typ in generics . type_params_mut ( ) { typ . bounds . push ( clone_bound . clone ( ) ) ; } generics } else { Default :: default ( ) } }
Add `Clone` trait bound to generic types for non-owned builders.
Add ` Clone ` trait bound to generic types for non - owned builders .
&self
&self