Skip to main content

CascadePropagation

Struct CascadePropagation 

Source
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

Source

pub fn new<S: PlanningSolution>(solution: &S) -> Self

Propagation state for solution, with its dependency index built.

Source

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.

Source

pub fn refresh_all<S: PlanningSolution>(solution: &mut S)

Recomputes every cascading value of solution from scratch.

Source

pub fn propagate<S, I, W>( &mut self, solution: &mut S, changed: I, before_write: W, )
where S: PlanningSolution, I: IntoIterator<Item = usize>, W: FnMut(&S, usize),

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.

Trait Implementations§

Source§

impl Default for CascadePropagation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.