pub fn new_with_members(fields: &syn::FieldsNamed) -> Model {
        let mut model = Model {
            fields: fields
                .named
                .iter()
                .filter_map(|f| {
                    let name = f.ident.clone().expect("Failed unwrap field name.");
                    let attr = parse_attribute(&f.attrs, &name);
                    if attr.field.is_some() || attr.view.is_some() {
                        Some(Rc::new(Field::new_with_attr(name, f.ty.clone(), attr)))
                    } else {
                        None
                    }
                })
                .collect(),
            blink_type: None,
            sort_tag_type: None,
            class_fns: BTreeMap::new(),
            dfill_struct: None,
        };

        model.blink_type = model
            .fields
            .iter()
            .find_map(|f| f.blink_type.as_ref().map(|v| v.parse::<Tstream>().unwrap()));

        model.sort_tag_type = model.fields.iter().find_map(|f| f.sort_tag_type.clone());

        model.dfill_struct = model.fields.iter().find_map(|f| {
            f.field_attr
                .dfill_struct
                .as_ref()
                .map(|c| c.parse::<Tstream>().unwrap())
        });

        model.process_tags_and_class();

        model
    }
/// Generate new model from the fields
Generate new model from the fields
Generate new model from the fields
pub fn new_with_members(fields: &syn::FieldsNamed) -> Model {
        let mut model = Model {
            fields: fields
                .named
                .iter()
                .filter_map(|f| {
                    let name = f.ident.clone().expect("Failed unwrap field name.");
                    let attr = parse_attribute(&f.attrs, &name);
                    if attr.field.is_some() || attr.view.is_some() {
                        Some(Rc::new(Field::new_with_attr(name, f.ty.clone(), attr)))
                    } else {
                        None
                    }
                })
                .collect(),
            blink_type: None,
            sort_tag_type: None,
            class_fns: BTreeMap::new(),
            dfill_struct: None,
        };
        model.blink_type = model
            .fields
            .iter()
            .find_map(|f| f.blink_type.as_ref().map(|v| v.parse::<Tstream>().unwrap()));
        model.sort_tag_type = model.fields.iter().find_map(|f| f.sort_tag_type.clone());
        model.dfill_struct = model.fields.iter().find_map(|f| {
            f.field_attr
                .dfill_struct
                .as_ref()
                .map(|c| c.parse::<Tstream>().unwrap())
        });
        model.process_tags_and_class();
        model
    }
pub fn new_with_members ( fields : & syn :: FieldsNamed ) -> Model { let mut model = Model { fields : fields . named . iter ( ) . filter_map ( | f | { let name = f . ident . clone ( ) . expect ( " " ) ; let attr = parse_attribute ( & f . attrs , & name ) ; if attr . field . is_some ( ) || attr . view . is_some ( ) { Some ( Rc :: new ( Field :: new_with_attr ( name , f . ty . clone ( ) , attr ) ) ) } else { None } } ) . collect ( ) , blink_type : None , sort_tag_type : None , class_fns : BTreeMap :: new ( ) , dfill_struct : None , } ; model . blink_type = model . fields . iter ( ) . find_map ( | f | f . blink_type . as_ref ( ) . map ( | v | v . parse :: < Tstream > ( ) . unwrap ( ) ) ) ; model . sort_tag_type = model . fields . iter ( ) . find_map ( | f | f . sort_tag_type . clone ( ) ) ; model . dfill_struct = model . fields . iter ( ) . find_map ( | f | { f . field_attr . dfill_struct . as_ref ( ) . map ( | c | c . parse :: < Tstream > ( ) . unwrap ( ) ) } ) ; model . process_tags_and_class ( ) ; model }
Generate new model from the fields
Generate new model from the fields
fields
&syn::FieldsNamed
fields
&syn::FieldsNamed