pub fn filter_packages(&self, packages: &HashSet<String>) -> Option<SourceGroup<'ctx>> {
        let mut files = Vec::new();

        if self.package.is_none() || packages.contains(self.package.unwrap()) {
            files = self
                .files
                .iter()
                .filter_map(|file| match *file {
                    SourceFile::Group(ref group) => group
                        .filter_packages(packages)
                        .map(|g| SourceFile::Group(Box::new(g))),
                    ref other => Some(other.clone()),
                })
                .collect();
        }

        let mut export_incdirs = self.export_incdirs.clone();
        export_incdirs.retain(|k, _| packages.contains(k));
        Some(
            SourceGroup {
                package: self.package,
                independent: self.independent,
                target: self.target.clone(),
                include_dirs: self.include_dirs.clone(),
                export_incdirs: export_incdirs,
                defines: self.defines.clone(),
                files: files,
                dependencies: self.dependencies.clone(),
            }
            .simplify(),
        )
    }
/// Filter the sources, keeping only the ones that apply to the selected packages.
Filter the sources, keeping only the ones that apply to the selected packages.
Filter the sources keeping only the ones that apply to the selected packages .
pub fn filter_packages(&self, packages: &HashSet<String>) -> Option<SourceGroup<'ctx>> {
        let mut files = Vec::new();
        if self.package.is_none() || packages.contains(self.package.unwrap()) {
            files = self
                .files
                .iter()
                .filter_map(|file| match *file {
                    SourceFile::Group(ref group) => group
                        .filter_packages(packages)
                        .map(|g| SourceFile::Group(Box::new(g))),
                    ref other => Some(other.clone()),
                })
                .collect();
        }
        let mut export_incdirs = self.export_incdirs.clone();
        export_incdirs.retain(|k, _| packages.contains(k));
        Some(
            SourceGroup {
                package: self.package,
                independent: self.independent,
                target: self.target.clone(),
                include_dirs: self.include_dirs.clone(),
                export_incdirs: export_incdirs,
                defines: self.defines.clone(),
                files: files,
                dependencies: self.dependencies.clone(),
            }
            .simplify(),
        )
    }
pub fn filter_packages ( & self , packages : & HashSet < String > ) -> Option < SourceGroup < ' ctx > > { let mut files = Vec :: new ( ) ; if self . package . is_none ( ) || packages . contains ( self . package . unwrap ( ) ) { files = self . files . iter ( ) . filter_map ( | file | match * file { SourceFile :: Group ( ref group ) => group . filter_packages ( packages ) . map ( | g | SourceFile :: Group ( Box :: new ( g ) ) ) , ref other => Some ( other . clone ( ) ) , } ) . collect ( ) ; } let mut export_incdirs = self . export_incdirs . clone ( ) ; export_incdirs . retain ( | k , _ | packages . contains ( k ) ) ; Some ( SourceGroup { package : self . package , independent : self . independent , target : self . target . clone ( ) , include_dirs : self . include_dirs . clone ( ) , export_incdirs : export_incdirs , defines : self . defines . clone ( ) , files : files , dependencies : self . dependencies . clone ( ) , } . simplify ( ) , ) }
Filter the sources, keeping only the ones that apply to the selected packages.
Filter the sources keeping only the ones that apply to the selected packages .
&self
packages
&HashSet<String>
&self
packages
&HashSet<String>