fn init(&mut self, fields: Option<Vec<Self::FieldsType>>) {
        // If all set to true or no fields are provided, we should display all
        // l0 fields. In another word, all will override opt and fields.
        let opts = self.get_opts_mut();
        if opts.everything {
            opts.default = true;
            opts.detail = true;
        }

        let mut fields = if opts.default || fields.is_none() {
            Some(Self::get_all_classes())
        } else {
            fields
        };

        // Dedup if JSON, it will break the order here. But since the output
        // format is JSON, order may not be that important.
        if let Some(OutputFormat::Json) = opts.output_format {
            let hs = fields
                .unwrap()
                .into_iter()
                .collect::<HashSet<Self::FieldsType>>();

            fields = Some(hs.into_iter().collect());
        }

        match opts.output_format {
            Some(OutputFormat::Raw) | None => {
                self.build_title_fns_styled(&fields);
                self.build_field_fns_styled(&fields);
            }
            _ => {
                self.build_title_fns(&fields);
                self.build_field_fns(&fields);
            }
        }
    }
// Init function is responsible for calling the dfill build_* functions to build the fn vec.
Init function is responsible for calling the dfill build_* functions to build the fn vec.
Init function is responsible for calling the dfill build_ * functions to build the fn vec .
fn init(&mut self, fields: Option<Vec<Self::FieldsType>>) {
        // If all set to true or no fields are provided, we should display all
        // l0 fields. In another word, all will override opt and fields.
        let opts = self.get_opts_mut();
        if opts.everything {
            opts.default = true;
            opts.detail = true;
        }
        let mut fields = if opts.default || fields.is_none() {
            Some(Self::get_all_classes())
        } else {
            fields
        };
        // Dedup if JSON, it will break the order here. But since the output
        // format is JSON, order may not be that important.
        if let Some(OutputFormat::Json) = opts.output_format {
            let hs = fields
                .unwrap()
                .into_iter()
                .collect::<HashSet<Self::FieldsType>>();
            fields = Some(hs.into_iter().collect());
        }
        match opts.output_format {
            Some(OutputFormat::Raw) | None => {
                self.build_title_fns_styled(&fields);
                self.build_field_fns_styled(&fields);
            }
            _ => {
                self.build_title_fns(&fields);
                self.build_field_fns(&fields);
            }
        }
    }
fn init ( & mut self , fields : Option < Vec < Self :: FieldsType > > ) { // If all set to true or no fields are provided, we should display all // l0 fields. In another word, all will override opt and fields. let opts = self . get_opts_mut ( ) ; if opts . everything { opts . default = true ; opts . detail = true ; } let mut fields = if opts . default || fields . is_none ( ) { Some ( Self :: get_all_classes ( ) ) } else { fields } ; // Dedup if JSON, it will break the order here. But since the output // format is JSON, order may not be that important. if let Some ( OutputFormat :: Json ) = opts . output_format { let hs = fields . unwrap ( ) . into_iter ( ) . collect :: < HashSet < Self :: FieldsType > > ( ) ; fields = Some ( hs . into_iter ( ) . collect ( ) ) ; } match opts . output_format { Some ( OutputFormat :: Raw ) | None => { self . build_title_fns_styled ( & fields ) ; self . build_field_fns_styled ( & fields ) ; } _ => { self . build_title_fns ( & fields ) ; self . build_field_fns ( & fields ) ; } } }
Init function is responsible for calling the dfill build_* functions to build the fn vec.
Init function is responsible for calling the dfill build_ * functions to build the fn vec .
&mut self
fields
Option<Vec<Self::FieldsType>>
&mut self
fields
Option<Vec<Self::FieldsType>>