fn gen_dfill_cmp_fns(&self) -> Tstream {
        let match_arms = self
            .fields
            .iter()
            .filter(|f| f.field_attr.tag.is_some() && f.field_attr.cmp)
            .map(|f| {
                let cmp_fn_name = format!("cmp_by_{}", f.name).parse::<Tstream>().unwrap();
                let sort_tag_val = f
                    .field_attr
                    .tag
                    .as_ref()
                    .unwrap()
                    .parse::<Tstream>()
                    .unwrap();
                quote! {
                    #sort_tag_val => items.sort_by(|lhs, rhs| {
                        if reverse {
                            data.#cmp_fn_name(&lhs, &rhs)
                                .unwrap_or(std::cmp::Ordering::Equal)
                                .reverse()
                        } else {
                            data.#cmp_fn_name(&lhs, &rhs)
                                .unwrap_or(std::cmp::Ordering::Equal)
                        }
                    }),
                }
            });

        quote! {
            #(#match_arms)*
        }
    }
/// Generate compare arm for dfill
/// Generated code is same as generate_sort_fn
Generate compare arm for dfill
Generated code is same as generate_sort_fn
Generate compare arm for dfill Generated code is same as generate_sort_fn
fn gen_dfill_cmp_fns(&self) -> Tstream {
        let match_arms = self
            .fields
            .iter()
            .filter(|f| f.field_attr.tag.is_some() && f.field_attr.cmp)
            .map(|f| {
                let cmp_fn_name = format!("cmp_by_{}", f.name).parse::<Tstream>().unwrap();
                let sort_tag_val = f
                    .field_attr
                    .tag
                    .as_ref()
                    .unwrap()
                    .parse::<Tstream>()
                    .unwrap();
                quote! {
                    #sort_tag_val => items.sort_by(|lhs, rhs| {
                        if reverse {
                            data.#cmp_fn_name(&lhs, &rhs)
                                .unwrap_or(std::cmp::Ordering::Equal)
                                .reverse()
                        } else {
                            data.#cmp_fn_name(&lhs, &rhs)
                                .unwrap_or(std::cmp::Ordering::Equal)
                        }
                    }),
                }
            });
        quote! {
            #(#match_arms)*
        }
    }
fn gen_dfill_cmp_fns ( & self ) -> Tstream { let match_arms = self . fields . iter ( ) . filter ( | f | f . field_attr . tag . is_some ( ) && f . field_attr . cmp ) . map ( | f | { let cmp_fn_name = format ! ( " " f name ) . parse :: < Tstream > ( ) . unwrap ( ) ; let sort_tag_val = f . field_attr . tag . as_ref ( ) . unwrap ( ) . parse :: < Tstream > ( ) . unwrap ( ) ; quote ! { sort_tag_val items sort_by ( lhs rhs { if reverse { data cmp_fn_name ( lhs rhs ) unwrap_or ( std cmp Ordering Equal ) reverse ( ) } else { data cmp_fn_name ( lhs rhs ) unwrap_or ( std cmp Ordering Equal ) } } ) } } ) ; quote ! { ( match_arms ) } }
Generate compare arm for dfill
Generated code is same as generate_sort_fn
Generate compare arm for dfill Generated code is same as generate_sort_fn
&self
&self