Whether `descendant` is `ancestor` or transitively depends on it. `dependencies` lists a change's direct dependencies.
(
&mut self,
descendant: K,
ancestor: K,
dependencies: &mut impl FnMut(K) -> Result<Vec<K>, E>,
)
| 28 | /// Whether `descendant` is `ancestor` or transitively depends on it. |
| 29 | /// `dependencies` lists a change's direct dependencies. |
| 30 | pub(crate) fn depends_on<E>( |
| 31 | &mut self, |
| 32 | descendant: K, |
| 33 | ancestor: K, |
| 34 | dependencies: &mut impl FnMut(K) -> Result<Vec<K>, E>, |
| 35 | ) -> Result<bool, E> { |
| 36 | if descendant == ancestor { |
| 37 | return Ok(true); |
| 38 | } |
| 39 | Ok(self |
| 40 | .ancestors_of(descendant, dependencies)? |
| 41 | .contains(&ancestor)) |
| 42 | } |
| 43 | |
| 44 | /// The transitive dependency set of `change`, computed once. The walk is |
| 45 | /// iterative, so a long linear history cannot overflow the stack, and a |
no test coverage detected