fn invalidate_from_roots<P: Fn(&N) -> bool>(&mut self, predicate: P) -> InvalidationResult {
    // Collect all entries that will be cleared.
    let root_ids: HashSet<_, FNV> = self
      .nodes
      .iter()
      .filter_map(|(node, &entry_id)| {
        // A NotStarted entry does not need clearing, and we can assume that its dependencies are
        // either already dirtied, or have never observed a value for it. Filtering these redundant
        // events helps to "debounce" invalidation (ie, avoid redundant re-dirtying of dependencies).
        if predicate(node) && self.unsafe_entry_for_id(entry_id).is_started() {
          Some(entry_id)
        } else {
          None
        }
      })
      .collect();
    // And their live transitive dependencies, which will be dirtied.
    let transitive_ids: Vec<_> = self
      .walk(
        root_ids.iter().cloned().collect(),
        Direction::Incoming,
        Self::live_edge_predicate(&self),
      )
      .filter(|eid| !root_ids.contains(eid))
      .collect();

    let invalidation_result = InvalidationResult {
      cleared: root_ids.len(),
      dirtied: transitive_ids.len(),
    };

    // Clear the roots.
    for id in &root_ids {
      if let Some(entry) = self.pg.node_weight_mut(*id) {
        entry.clear();
      }
    }

    // Dirty transitive entries, but do not yet clear their output edges. We wait to clear
    // outbound edges until we decide whether we can clean an entry: if we can, all edges are
    // preserved; if we can't, they are eventually cleaned in `Graph::garbage_collect_edges`.
    for id in &transitive_ids {
      if let Some(mut entry) = self.pg.node_weight_mut(*id).cloned() {
        entry.dirty(self);
      }
    }

    invalidation_result
  }
///
/// Clears the values of all "invalidation root" Nodes and dirties their transitive dependents.
///
/// An "invalidation root" is a Node in the graph which can be invalidated for a reason other
/// than having had its dependencies changed.
///
Clears the values of all "invalidation root" Nodes and dirties their transitive dependents.
An "invalidation root" is a Node in the graph which can be invalidated for a reason other
than having had its dependencies changed.
Clears the values of all " invalidation root " Nodes and dirties their transitive dependents . An " invalidation root " is a Node in the graph which can be invalidated for a reason other than having had its dependencies changed .
fn invalidate_from_roots<P: Fn(&N) -> bool>(&mut self, predicate: P) -> InvalidationResult {
    // Collect all entries that will be cleared.
    let root_ids: HashSet<_, FNV> = self
      .nodes
      .iter()
      .filter_map(|(node, &entry_id)| {
        // A NotStarted entry does not need clearing, and we can assume that its dependencies are
        // either already dirtied, or have never observed a value for it. Filtering these redundant
        // events helps to "debounce" invalidation (ie, avoid redundant re-dirtying of dependencies).
        if predicate(node) && self.unsafe_entry_for_id(entry_id).is_started() {
          Some(entry_id)
        } else {
          None
        }
      })
      .collect();
    // And their live transitive dependencies, which will be dirtied.
    let transitive_ids: Vec<_> = self
      .walk(
        root_ids.iter().cloned().collect(),
        Direction::Incoming,
        Self::live_edge_predicate(&self),
      )
      .filter(|eid| !root_ids.contains(eid))
      .collect();
    let invalidation_result = InvalidationResult {
      cleared: root_ids.len(),
      dirtied: transitive_ids.len(),
    };
    // Clear the roots.
    for id in &root_ids {
      if let Some(entry) = self.pg.node_weight_mut(*id) {
        entry.clear();
      }
    }
    // Dirty transitive entries, but do not yet clear their output edges. We wait to clear
    // outbound edges until we decide whether we can clean an entry: if we can, all edges are
    // preserved; if we can't, they are eventually cleaned in `Graph::garbage_collect_edges`.
    for id in &transitive_ids {
      if let Some(mut entry) = self.pg.node_weight_mut(*id).cloned() {
        entry.dirty(self);
      }
    }
    invalidation_result
  }
fn invalidate_from_roots < P : Fn ( & N ) -> bool > ( & mut self , predicate : P ) -> InvalidationResult { // Collect all entries that will be cleared. let root_ids : HashSet < _ , FNV > = self . nodes . iter ( ) . filter_map ( | ( node , & entry_id ) | { // A NotStarted entry does not need clearing, and we can assume that its dependencies are // either already dirtied, or have never observed a value for it. Filtering these redundant // events helps to "debounce" invalidation (ie, avoid redundant re-dirtying of dependencies). if predicate ( node ) && self . unsafe_entry_for_id ( entry_id ) . is_started ( ) { Some ( entry_id ) } else { None } } ) . collect ( ) ; // And their live transitive dependencies, which will be dirtied. let transitive_ids : Vec < _ > = self . walk ( root_ids . iter ( ) . cloned ( ) . collect ( ) , Direction :: Incoming , Self :: live_edge_predicate ( & self ) , ) . filter ( | eid | ! root_ids . contains ( eid ) ) . collect ( ) ; let invalidation_result = InvalidationResult { cleared : root_ids . len ( ) , dirtied : transitive_ids . len ( ) , } ; // Clear the roots. for id in & root_ids { if let Some ( entry ) = self . pg . node_weight_mut ( * id ) { entry . clear ( ) ; } } // Dirty transitive entries, but do not yet clear their output edges. We wait to clear // outbound edges until we decide whether we can clean an entry: if we can, all edges are // preserved; if we can't, they are eventually cleaned in `Graph::garbage_collect_edges`. for id in & transitive_ids { if let Some ( mut entry ) = self . pg . node_weight_mut ( * id ) . cloned ( ) { entry . dirty ( self ) ; } } invalidation_result }
Clears the values of all "invalidation root" Nodes and dirties their transitive dependents.
Clears the values of all " invalidation root " Nodes and dirties their transitive dependents .
&mut self
predicate
P
&mut self
predicate
P