/// Generate new field from the attributes
Generate new field from the attributes
Generate new field from the attributes
pub fn new_with_attr(name: syn::Ident, field_type: syn::Type, attr: attr::BelowAttr) -> Field {
        let inner_type = Self::parse_option(&field_type);
        let is_option = inner_type.is_some();
        let field_attr = attr.field.unwrap_or_default();
        let view_attr = attr.view.unwrap_or_default();
        let width = view_attr.width.unwrap_or(0);
        let (sort_tag_type, sort_tag_val) = Self::parse_sort_tag(&field_attr, &name);
        Field {
            name: name.clone(),
            field_type: field_type.clone(),
            inner_type: inner_type.clone(),
            field_attr: field_attr.clone(),
            view_attr: view_attr.clone(),
            aggr_val: Self::parse_aggr_val(&field_attr.link, is_option),
            blink_type: Self::parse_blink_type(&field_attr.link),
            blink_prefix: Self::parse_blink_prefix(&field_attr.link, &name),
            sort_tag_type,
            sort_tag_val,
            decor_value: Self::parse_decor(&view_attr, &inner_type, &field_type),
            prefix: view_attr.prefix.clone().unwrap_or_else(|| quote! {""}),
            depth: view_attr.depth.clone().unwrap_or_else(|| quote! {0}),
            width: quote! {#width},
            unit: view_attr.unit.clone().unwrap_or_else(|| "".into()),
            highlight_if_value: Self::parse_highlight_if(&view_attr, &inner_type, &field_type),
            dfill_tag_title: None,
            dfill_tag_title_styled: None,
            dfill_tag_field: None,
            dfill_tag_field_styled: None,
        }
        .build_dfill_tags()
    }
pub fn new_with_attr ( name : syn :: Ident , field_type : syn :: Type , attr : attr :: BelowAttr ) -> Field { let inner_type = Self :: parse_option ( & field_type ) ; let is_option = inner_type . is_some ( ) ; let field_attr = attr . field . unwrap_or_default ( ) ; let view_attr = attr . view . unwrap_or_default ( ) ; let width = view_attr . width . unwrap_or ( 0 ) ; let ( sort_tag_type , sort_tag_val ) = Self :: parse_sort_tag ( & field_attr , & name ) ; Field { name : name . clone ( ) , field_type : field_type . clone ( ) , inner_type : inner_type . clone ( ) , field_attr : field_attr . clone ( ) , view_attr : view_attr . clone ( ) , aggr_val : Self :: parse_aggr_val ( & field_attr . link , is_option ) , blink_type : Self :: parse_blink_type ( & field_attr . link ) , blink_prefix : Self :: parse_blink_prefix ( & field_attr . link , & name ) , sort_tag_type , sort_tag_val , decor_value : Self :: parse_decor ( & view_attr , & inner_type , & field_type ) , prefix : view_attr . prefix . clone ( ) . unwrap_or_else ( | | quote ! { " " } ) , depth : view_attr . depth . clone ( ) . unwrap_or_else ( | | quote ! { 0 } ) , width : quote ! { width } , unit : view_attr . unit . clone ( ) . unwrap_or_else ( | | " " . into ( ) ) , highlight_if_value : Self :: parse_highlight_if ( & view_attr , & inner_type , & field_type ) , dfill_tag_title : None , dfill_tag_title_styled : None , dfill_tag_field : None , dfill_tag_field_styled : None , } . build_dfill_tags ( ) }
Generate new field from the attributes
Generate new field from the attributes
name
syn::Ident
field_type
syn::Type
attr
attr::BelowAttr