pub struct DynamicScore {
pub hard: i64,
pub medium: i64,
pub soft: i64,
pub family: DynamicScoreFamily,
}Expand description
Dynamic score used by host-language bindings.
The static Score trait requires a static level count. The bridge therefore
stores one concrete three-level representation internally and carries the
declared host-language family for presentation and host-boundary conversion.
Binding crates must validate that a solve uses one declared family
consistently.
Fields§
§hard: i64§medium: i64§soft: i64§family: DynamicScoreFamilyImplementations§
Source§impl DynamicScore
impl DynamicScore
pub const ZERO: Self
pub const fn of(hard: i64, medium: i64, soft: i64) -> Self
pub const fn with_family( hard: i64, medium: i64, soft: i64, family: DynamicScoreFamily, ) -> Self
pub const fn soft(soft: i64) -> Self
pub const fn hard_soft(hard: i64, soft: i64) -> Self
pub const fn hard_soft_decimal(hard_scaled: i64, soft_scaled: i64) -> Self
pub const fn hard_medium_soft(hard: i64, medium: i64, soft: i64) -> Self
pub const fn zero_for_family(family: DynamicScoreFamily) -> Self
pub fn family_levels(self, family: DynamicScoreFamily) -> Vec<i64>
Trait Implementations§
Source§impl Add for DynamicScore
impl Add for DynamicScore
Source§impl Clone for DynamicScore
impl Clone for DynamicScore
Source§fn clone(&self) -> DynamicScore
fn clone(&self) -> DynamicScore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DynamicScore
impl Debug for DynamicScore
Source§impl Default for DynamicScore
impl Default for DynamicScore
Source§fn default() -> DynamicScore
fn default() -> DynamicScore
Returns the “default value” for a type. Read more
Source§impl Display for DynamicScore
impl Display for DynamicScore
Source§impl Hash for DynamicScore
impl Hash for DynamicScore
Source§impl Neg for DynamicScore
impl Neg for DynamicScore
Source§impl Ord for DynamicScore
impl Ord for DynamicScore
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl ParseableScore for DynamicScore
impl ParseableScore for DynamicScore
fn parse(s: &str) -> Result<Self, ScoreParseError>
fn to_string_repr(&self) -> String
Source§impl PartialEq for DynamicScore
impl PartialEq for DynamicScore
Source§fn eq(&self, other: &DynamicScore) -> bool
fn eq(&self, other: &DynamicScore) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for DynamicScore
impl PartialOrd for DynamicScore
Source§impl Score for DynamicScore
impl Score for DynamicScore
fn is_feasible(&self) -> bool
fn zero() -> Self
fn levels_count() -> usize
fn level_number(&self, index: usize) -> i64
fn from_level_numbers(levels: &[i64]) -> Self
fn multiply(&self, multiplicand: f64) -> Self
fn divide(&self, divisor: f64) -> Self
fn abs(&self) -> Self
fn to_scalar(&self) -> f64
fn level_label(index: usize) -> ScoreLevel
fn to_level_numbers(&self) -> Vec<i64>
fn compare(&self, other: &Self) -> Ordering
fn is_better_than(&self, other: &Self) -> bool
fn is_worse_than(&self, other: &Self) -> bool
fn is_equal_to(&self, other: &Self) -> bool
fn one_hard() -> Self
fn one_soft() -> Self
fn one_medium() -> Self
Source§impl Sub for DynamicScore
impl Sub for DynamicScore
impl Copy for DynamicScore
impl Eq for DynamicScore
impl StructuralPartialEq for DynamicScore
Auto Trait Implementations§
impl Freeze for DynamicScore
impl RefUnwindSafe for DynamicScore
impl Send for DynamicScore
impl Sync for DynamicScore
impl Unpin for DynamicScore
impl UnsafeUnpin for DynamicScore
impl UnwindSafe for DynamicScore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more