/// returns true when there are direct matches among children
returns true when there are direct matches among children
returns true when there are direct matches among children
fn load_children(&mut self, bid: BId) -> bool {
        let mut has_child_match = false;
        match fs::read_dir(&self.blines[bid].path) {
            Ok(entries) => {
                let mut children: Vec<BId> = Vec::new();
                let child_depth = self.blines[bid].depth + 1;
                for e in entries {
                    if let Ok(e) = e {
                        let bl = self.make_line(
                            bid,
                            e,
                            child_depth,
                        );
                        match bl {
                            BLineResult::Some(child_id) => {
                                if self.blines[child_id].has_match {
                                    // direct match
                                    self.blines[bid].has_match = true;
                                    has_child_match = true;
                                }
                                children.push(child_id);
                            }
                            BLineResult::GitIgnored => {
                                self.nb_gitignored += 1;
                            }
                            _ => {
                                // other reason, we don't care
                            }
                        }
                    }
                }
                children.sort_by(|&a, &b| {
                    self.blines[a]
                        .name
                        .to_lowercase()
                        .cmp(&self.blines[b].name.to_lowercase())
                });
                self.blines[bid].children = Some(children);
            }
            Err(_err) => {
                self.blines[bid].has_error = true;
                self.blines[bid].children = Some(Vec::new());
            }
        }
        has_child_match
    }
fn load_children ( & mut self , bid : BId ) -> bool { let mut has_child_match = false ; match fs :: read_dir ( & self . blines [ bid ] . path ) { Ok ( entries ) => { let mut children : Vec < BId > = Vec :: new ( ) ; let child_depth = self . blines [ bid ] . depth + 1 ; for e in entries { if let Ok ( e ) = e { let bl = self . make_line ( bid , e , child_depth , ) ; match bl { BLineResult :: Some ( child_id ) => { if self . blines [ child_id ] . has_match { // direct match self . blines [ bid ] . has_match = true ; has_child_match = true ; } children . push ( child_id ) ; } BLineResult :: GitIgnored => { self . nb_gitignored += 1 ; } _ => { // other reason, we don't care } } } } children . sort_by ( | & a , & b | { self . blines [ a ] . name . to_lowercase ( ) . cmp ( & self . blines [ b ] . name . to_lowercase ( ) ) } ) ; self . blines [ bid ] . children = Some ( children ) ; } Err ( _err ) => { self . blines [ bid ] . has_error = true ; self . blines [ bid ] . children = Some ( Vec :: new ( ) ) ; } } has_child_match }
returns true when there are direct matches among children
returns true when there are direct matches among children
&mut self
bid
BId