pub struct CascadePropagation { /* private fields */ }Expand description
Reusable propagation state for one solution’s cascading shadow.
Holds the reverse index of the declared dependencies and the joint
groups, built by rebuild_dependencies and
valid while the dependencies, the peers and the element count stay
unchanged, plus per-node 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 and the joint groups from
solution and sizes the per-node scratch to its element count.
§Panics
When an element declares a dependency or a peer 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 member of a node holding an element of changed is recomputed;
another node of the downstream cone is recomputed when one of its
inputs changed value, or when a member is held by a list but unset (it
may have left a dependency cycle). Each node is recomputed at most
once, after all of its inputs in the cone, its members in ascending
element order. Before an element’s value is written, before_write
is called with the solution still holding the old value and the
element index.