pub fn dependencies_of<'a>(&'a self, target: &'a Target) -> Result<Vec<&'a Target>> {
        let mut sorted_deps = Vec::new();
        let mut unresolved_deps: Vec<(&Target, usize)> = Vec::new();
        unresolved_deps.push((target, 0));
        while let Some((dep, next_dep_idx)) = unresolved_deps.pop() {
            if let Some((transitive_dep_name, import_loc)) =
                dep.dependencies.iter().nth(next_dep_idx)
            {
                let lookup_base = dep.manifest_dir();
                let dep_name = &dep.name;
                let transitive_dep_target =
                    self.lookup_target(&transitive_dep_name, &import_loc, lookup_base)?;
                if unresolved_deps
                    .iter()
                    .any(|(ud, _)| *ud == transitive_dep_target)
                {
                    return Err(WorkspaceError::CircularDependency(
                        dep_name.to_string(),
                        transitive_dep_name.to_string(),
                    )
                    .into());
                } else {
                    unresolved_deps.push((dep, next_dep_idx + 1));
                    unresolved_deps.push((transitive_dep_target, 0));
                }
            } else if !sorted_deps.iter().any(|sd| *sd == dep) {
                sorted_deps.push(dep);
            }
        }

        sorted_deps.pop().unwrap(); // remove the target itself
        Ok(sorted_deps)
    }
/// Returns the reverse topologically sorted dependencies of this `Target`.
Returns the reverse topologically sorted dependencies of this `Target`.
Returns the reverse topologically sorted dependencies of this ` Target ` .
pub fn dependencies_of<'a>(&'a self, target: &'a Target) -> Result<Vec<&'a Target>> {
        let mut sorted_deps = Vec::new();
        let mut unresolved_deps: Vec<(&Target, usize)> = Vec::new();
        unresolved_deps.push((target, 0));
        while let Some((dep, next_dep_idx)) = unresolved_deps.pop() {
            if let Some((transitive_dep_name, import_loc)) =
                dep.dependencies.iter().nth(next_dep_idx)
            {
                let lookup_base = dep.manifest_dir();
                let dep_name = &dep.name;
                let transitive_dep_target =
                    self.lookup_target(&transitive_dep_name, &import_loc, lookup_base)?;
                if unresolved_deps
                    .iter()
                    .any(|(ud, _)| *ud == transitive_dep_target)
                {
                    return Err(WorkspaceError::CircularDependency(
                        dep_name.to_string(),
                        transitive_dep_name.to_string(),
                    )
                    .into());
                } else {
                    unresolved_deps.push((dep, next_dep_idx + 1));
                    unresolved_deps.push((transitive_dep_target, 0));
                }
            } else if !sorted_deps.iter().any(|sd| *sd == dep) {
                sorted_deps.push(dep);
            }
        }
        sorted_deps.pop().unwrap(); // remove the target itself
        Ok(sorted_deps)
    }
pub fn dependencies_of < ' a > ( & ' a self , target : & ' a Target ) -> Result < Vec < & ' a Target > > { let mut sorted_deps = Vec :: new ( ) ; let mut unresolved_deps : Vec < ( & Target , usize ) > = Vec :: new ( ) ; unresolved_deps . push ( ( target , 0 ) ) ; while let Some ( ( dep , next_dep_idx ) ) = unresolved_deps . pop ( ) { if let Some ( ( transitive_dep_name , import_loc ) ) = dep . dependencies . iter ( ) . nth ( next_dep_idx ) { let lookup_base = dep . manifest_dir ( ) ; let dep_name = & dep . name ; let transitive_dep_target = self . lookup_target ( & transitive_dep_name , & import_loc , lookup_base ) ? ; if unresolved_deps . iter ( ) . any ( | ( ud , _ ) | * ud == transitive_dep_target ) { return Err ( WorkspaceError :: CircularDependency ( dep_name . to_string ( ) , transitive_dep_name . to_string ( ) , ) . into ( ) ) ; } else { unresolved_deps . push ( ( dep , next_dep_idx + 1 ) ) ; unresolved_deps . push ( ( transitive_dep_target , 0 ) ) ; } } else if ! sorted_deps . iter ( ) . any ( | sd | * sd == dep ) { sorted_deps . push ( dep ) ; } } sorted_deps . pop ( ) . unwrap ( ) ; // remove the target itself Ok ( sorted_deps ) }
Returns the reverse topologically sorted dependencies of this `Target`.
Returns the reverse topologically sorted dependencies of this ` Target ` .
&'a self
target
&'a Target
&'a self
target
&'a Target