pub struct CascadePropagation { /* private fields */ }Expand description
Reusable propagation state for one solution’s cascading shadow.
Holds the reverse index of the declared dependencies, built by
rebuild_dependencies and valid while the
dependencies and the element count stay unchanged, plus per-element
scratch that every propagation leaves cleared.
Implementations§
Source§impl CascadePropagation
impl CascadePropagation
Sourcepub fn new<S: PlanningSolution>(solution: &S) -> Self
pub fn new<S: PlanningSolution>(solution: &S) -> Self
Propagation state for solution, with its dependency index built.
Sourcepub fn rebuild_dependencies<S: PlanningSolution>(&mut self, solution: &S)
pub fn rebuild_dependencies<S: PlanningSolution>(&mut self, solution: &S)
Rebuilds the reverse dependency index from solution and sizes the
per-element scratch to its element count.
§Panics
When an element declares a dependency on an element index that does not exist.
Sourcepub fn refresh_all<S: PlanningSolution>(solution: &mut S)
pub fn refresh_all<S: PlanningSolution>(solution: &mut S)
Recomputes every cascading value of solution from scratch.
Sourcepub fn propagate<S, I, W>(
&mut self,
solution: &mut S,
changed: I,
before_write: W,
)
pub fn propagate<S, I, W>( &mut self, solution: &mut S, changed: I, before_write: W, )
Recomputes the cascading values downstream of changed, the elements
whose list position or list membership changed.
Every element of changed is recomputed; another element of the
downstream cone is recomputed when one of its inputs changed value, or
when it is held by a list but unset (it may have left a dependency
cycle). Each element is recomputed at most once, after all of its
inputs in the cone. Before an element’s value is written,
before_write is called with the solution still holding the old value
and the element index.