fn handle_field_struct(
    fields: &FieldsNamed,
    serde: &SerdeProps,
    props_gen: &mut proc_macro2::TokenStream,
) {
    for field in &fields.named {
        let mut field_name = field
            .ident
            .as_ref()
            .expect("missing field name?")
            .to_string();

        if let Some(renamed) = SerdeRename::from_field_attrs(&field.attrs) {
            field_name = renamed;
        } else if let Some(prop) = serde.rename {
            field_name = prop.rename(&field_name);
        }

        let (ty_ref, is_required) = get_field_type(&field);

        let docs = extract_documentation(&field.attrs);
        let docs = docs.trim();

        let mut gen = quote!(
            {
                let mut s = #ty_ref::raw_schema();
                if !#docs.is_empty() {
                    s.description = Some(#docs.to_string());
                }
                schema.properties.insert(#field_name.into(), s.into());
            }
        );

        if is_required {
            gen.extend(quote! {
                schema.required.insert(#field_name.into());
            });
        }

        props_gen.extend(gen);
    }
}
/// Generates code for a struct with fields.
Generates code for a struct with fields.
Generates code for a struct with fields .
fn handle_field_struct(
    fields: &FieldsNamed,
    serde: &SerdeProps,
    props_gen: &mut proc_macro2::TokenStream,
) {
    for field in &fields.named {
        let mut field_name = field
            .ident
            .as_ref()
            .expect("missing field name?")
            .to_string();
        if let Some(renamed) = SerdeRename::from_field_attrs(&field.attrs) {
            field_name = renamed;
        } else if let Some(prop) = serde.rename {
            field_name = prop.rename(&field_name);
        }
        let (ty_ref, is_required) = get_field_type(&field);
        let docs = extract_documentation(&field.attrs);
        let docs = docs.trim();
        let mut gen = quote!(
            {
                let mut s = #ty_ref::raw_schema();
                if !#docs.is_empty() {
                    s.description = Some(#docs.to_string());
                }
                schema.properties.insert(#field_name.into(), s.into());
            }
        );
        if is_required {
            gen.extend(quote! {
                schema.required.insert(#field_name.into());
            });
        }
        props_gen.extend(gen);
    }
}
fn handle_field_struct ( fields : & FieldsNamed , serde : & SerdeProps , props_gen : & mut proc_macro2 :: TokenStream , ) { for field in & fields . named { let mut field_name = field . ident . as_ref ( ) . expect ( " " ) . to_string ( ) ; if let Some ( renamed ) = SerdeRename :: from_field_attrs ( & field . attrs ) { field_name = renamed ; } else if let Some ( prop ) = serde . rename { field_name = prop . rename ( & field_name ) ; } let ( ty_ref , is_required ) = get_field_type ( & field ) ; let docs = extract_documentation ( & field . attrs ) ; let docs = docs . trim ( ) ; let mut gen = quote ! ( { let mut s ty_ref raw_schema ( ) if docs is_empty ( ) { s description Some ( docs to_string ( ) ) } schema properties insert ( field_name into ( ) s into ( ) ) } ) ; if is_required { gen . extend ( quote ! { schema required insert ( field_name into ( ) ) } ) ; } props_gen . extend ( gen ) ; } }
Generates code for a struct with fields.
Generates code for a struct with fields .
fields
&FieldsNamed
serde
&SerdeProps
props_gen
&mut proc_macro2::TokenStream