Skip to main content

ConstraintSetChain

Struct ConstraintSetChain 

Source
pub struct ConstraintSetChain<Left, Right> { /* private fields */ }
Expand description

Two constraint sets scored as one, left first then right.

Results, metadata entries and weight slots list every Left constraint before every Right one. #[solverforge_constraints] builds these to join member sets without erasing their concrete types.

Implementations§

Source§

impl<Left, Right> ConstraintSetChain<Left, Right>

Source

pub fn new(left: Left, right: Right) -> Self

Chains left and right; the left set’s constraints come first.

Trait Implementations§

Source§

impl<S, Sc, Left, Right> ConstraintSet<S, Sc> for ConstraintSetChain<Left, Right>
where S: Send + Sync, Sc: Score, Left: ConstraintSet<S, Sc>, Right: ConstraintSet<S, Sc>,

Source§

fn evaluate_all(&self, solution: &S) -> Sc

Evaluates all constraints and returns the total score.
Source§

fn constraint_count(&self) -> usize

Returns the number of constraints in this set.
Source§

fn evaluate_each<'a>(&'a self, solution: &S) -> Vec<ConstraintResult<'a, Sc>>

Evaluates each constraint individually and returns per-constraint results. Read more
Source§

fn evaluate_detailed<'a>( &'a self, solution: &S, ) -> Vec<ConstraintAnalysis<'a, Sc>>

Evaluates each constraint with detailed match information. Read more
Source§

fn initialize_all(&mut self, solution: &S) -> Sc

Initializes all constraints by inserting all entities. Read more
Source§

fn on_insert_all( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> Sc

Called when an entity is inserted. Read more
Source§

fn on_retract_all( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, ) -> Sc

Called when an entity is retracted. Read more
Source§

fn reset_all(&mut self)

Resets all constraints for a new solving session.
Source§

fn constraint_weight_refs<'a>(&'a self, refs: &mut Vec<&'a ConstraintRef>)

Runtime constraint weights. Read more
Source§

fn evaluate_all_weighted(&self, solution: &S, multipliers: &[u32]) -> Sc

Weighted evaluate_all: multipliers holds one multiplier per weight slot.
Source§

fn initialize_all_weighted(&mut self, solution: &S, multipliers: &[u32]) -> Sc

Weighted initialize_all.
Source§

fn on_insert_all_weighted( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, multipliers: &[u32], ) -> Sc

Weighted on_insert_all.
Source§

fn on_retract_all_weighted( &mut self, solution: &S, entity_index: usize, descriptor_index: usize, multipliers: &[u32], ) -> Sc

Weighted on_retract_all.
Source§

fn evaluate_each_weighted<'a>( &'a self, solution: &S, multipliers: &[u32], ) -> Vec<ConstraintResult<'a, Sc>>

Weighted evaluate_each: weighted scores, with each result’s weight_multiplier set from its slot.
Source§

fn evaluate_detailed_weighted<'a>( &'a self, solution: &S, multipliers: &[u32], ) -> Vec<ConstraintAnalysis<'a, Sc>>

Weighted evaluate_detailed: weighted totals and match scores, with each analysis’s weight_multiplier set from its slot.
Source§

fn constraint_metadata(&self) -> Vec<ConstraintMetadata<'_>>

Returns deduplicated immutable metadata for constraints in this set.

Auto Trait Implementations§

§

impl<Left, Right> Freeze for ConstraintSetChain<Left, Right>
where Left: Freeze, Right: Freeze,

§

impl<Left, Right> RefUnwindSafe for ConstraintSetChain<Left, Right>
where Left: RefUnwindSafe, Right: RefUnwindSafe,

§

impl<Left, Right> Send for ConstraintSetChain<Left, Right>
where Left: Send, Right: Send,

§

impl<Left, Right> Sync for ConstraintSetChain<Left, Right>
where Left: Sync, Right: Sync,

§

impl<Left, Right> Unpin for ConstraintSetChain<Left, Right>
where Left: Unpin, Right: Unpin,

§

impl<Left, Right> UnsafeUnpin for ConstraintSetChain<Left, Right>
where Left: UnsafeUnpin, Right: UnsafeUnpin,

§

impl<Left, Right> UnwindSafe for ConstraintSetChain<Left, Right>
where Left: UnwindSafe, Right: UnwindSafe,

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.