fn doc_deps(&self, unit: &Unit<'a>) -> Vec<Unit<'a>> {
        let deps = self.resolve.deps(unit.pkg.package_id()).into_iter();
        let deps = deps.flat_map(|a| a).map(|id| {
            self.get_package(id)
        }).filter(|dep| {
            unit.pkg.dependencies().iter().filter(|d| {
                d.name() == dep.name()
            }).any(|dep| {
                match dep.kind() {
                    DepKind::Normal => self.dep_platform_activated(dep,
                                                                   unit.kind),
                    _ => false,
                }
            })
        }).filter_map(|dep| {
            dep.targets().iter().find(|t| t.is_lib()).map(|t| (dep, t))
        });

        // To document a library, we depend on dependencies actually being
        // built. If we're documenting *all* libraries, then we also depend on
        // the documentation of the library being built.
        let mut ret = Vec::new();
        for (dep, lib) in deps {
            ret.push(Unit {
                pkg: dep,
                target: lib,
                profile: self.lib_profile(dep.package_id()),
                kind: unit.kind.for_target(lib),
            });
            if self.build_config.doc_all {
                ret.push(Unit {
                    pkg: dep,
                    target: lib,
                    profile: &self.profiles.doc,
                    kind: unit.kind.for_target(lib),
                });
            }
        }

        // Be sure to build/run the build script for documented libraries as
        ret.extend(self.dep_build_script(unit));

        // If we document a binary, we need the library available
        if unit.target.is_bin() {
            ret.extend(self.maybe_lib(unit));
        }
        ret
    }
/// Returns the dependencies necessary to document a package
Returns the dependencies necessary to document a package
Returns the dependencies necessary to document a package
fn doc_deps(&self, unit: &Unit<'a>) -> Vec<Unit<'a>> {
        let deps = self.resolve.deps(unit.pkg.package_id()).into_iter();
        let deps = deps.flat_map(|a| a).map(|id| {
            self.get_package(id)
        }).filter(|dep| {
            unit.pkg.dependencies().iter().filter(|d| {
                d.name() == dep.name()
            }).any(|dep| {
                match dep.kind() {
                    DepKind::Normal => self.dep_platform_activated(dep,
                                                                   unit.kind),
                    _ => false,
                }
            })
        }).filter_map(|dep| {
            dep.targets().iter().find(|t| t.is_lib()).map(|t| (dep, t))
        });
        // To document a library, we depend on dependencies actually being
        // built. If we're documenting *all* libraries, then we also depend on
        // the documentation of the library being built.
        let mut ret = Vec::new();
        for (dep, lib) in deps {
            ret.push(Unit {
                pkg: dep,
                target: lib,
                profile: self.lib_profile(dep.package_id()),
                kind: unit.kind.for_target(lib),
            });
            if self.build_config.doc_all {
                ret.push(Unit {
                    pkg: dep,
                    target: lib,
                    profile: &self.profiles.doc,
                    kind: unit.kind.for_target(lib),
                });
            }
        }
        // Be sure to build/run the build script for documented libraries as
        ret.extend(self.dep_build_script(unit));
        // If we document a binary, we need the library available
        if unit.target.is_bin() {
            ret.extend(self.maybe_lib(unit));
        }
        ret
    }
fn doc_deps ( & self , unit : & Unit < ' a > ) -> Vec < Unit < ' a > > { let deps = self . resolve . deps ( unit . pkg . package_id ( ) ) . into_iter ( ) ; let deps = deps . flat_map ( | a | a ) . map ( | id | { self . get_package ( id ) } ) . filter ( | dep | { unit . pkg . dependencies ( ) . iter ( ) . filter ( | d | { d . name ( ) == dep . name ( ) } ) . any ( | dep | { match dep . kind ( ) { DepKind :: Normal => self . dep_platform_activated ( dep , unit . kind ) , _ => false , } } ) } ) . filter_map ( | dep | { dep . targets ( ) . iter ( ) . find ( | t | t . is_lib ( ) ) . map ( | t | ( dep , t ) ) } ) ; // To document a library, we depend on dependencies actually being // built. If we're documenting *all* libraries, then we also depend on // the documentation of the library being built. let mut ret = Vec :: new ( ) ; for ( dep , lib ) in deps { ret . push ( Unit { pkg : dep , target : lib , profile : self . lib_profile ( dep . package_id ( ) ) , kind : unit . kind . for_target ( lib ) , } ) ; if self . build_config . doc_all { ret . push ( Unit { pkg : dep , target : lib , profile : & self . profiles . doc , kind : unit . kind . for_target ( lib ) , } ) ; } } // Be sure to build/run the build script for documented libraries as ret . extend ( self . dep_build_script ( unit ) ) ; // If we document a binary, we need the library available if unit . target . is_bin ( ) { ret . extend ( self . maybe_lib ( unit ) ) ; } ret }
Returns the dependencies necessary to document a package
Returns the dependencies necessary to document a package
&self
unit
&Unit<'a>
&self
unit
&Unit<'a>