pub struct ConstraintResult<Sc> {
pub name: String,
pub score: Sc,
pub match_count: usize,
pub is_hard: bool,
}Expand description
A set of constraints that can be evaluated together.
ConstraintSet is implemented for tuples of IncrementalConstraint,
enabling fully typed constraint evaluation without virtual dispatch.
§Example
use solverforge_scoring::api::constraint_set::ConstraintSet;
use solverforge_core::score::SimpleScore;
fn evaluate_typed<S, C: ConstraintSet<S, SimpleScore>>(
constraints: &C,
solution: &S,
) -> SimpleScore {
constraints.evaluate_all(solution)
}Result of evaluating a single constraint.
Fields§
§name: StringConstraint name.
score: ScScore contribution from this constraint.
match_count: usizeNumber of matches for this constraint.
is_hard: boolWhether this is a hard constraint.
Trait Implementations§
Source§impl<Sc: Clone> Clone for ConstraintResult<Sc>
impl<Sc: Clone> Clone for ConstraintResult<Sc>
Source§fn clone(&self) -> ConstraintResult<Sc>
fn clone(&self) -> ConstraintResult<Sc>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<Sc> Freeze for ConstraintResult<Sc>where
Sc: Freeze,
impl<Sc> RefUnwindSafe for ConstraintResult<Sc>where
Sc: RefUnwindSafe,
impl<Sc> Send for ConstraintResult<Sc>where
Sc: Send,
impl<Sc> Sync for ConstraintResult<Sc>where
Sc: Sync,
impl<Sc> Unpin for ConstraintResult<Sc>where
Sc: Unpin,
impl<Sc> UnwindSafe for ConstraintResult<Sc>where
Sc: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more