pub struct Strength(/* private fields */);Implementations§
Source§impl Strength
impl Strength
Sourcepub const REQUIRED: Strength
pub const REQUIRED: Strength
The required strength for a constraint. This is the strongest possible strength.
Sourcepub const STRONG: Strength
pub const STRONG: Strength
A strong strength for a constraint. This is weaker than REQUIRED but stronger than
MEDIUM.
Sourcepub const MEDIUM: Strength
pub const MEDIUM: Strength
A medium strength for a constraint. This is weaker than STRONG but stronger than WEAK.
Sourcepub const WEAK: Strength
pub const WEAK: Strength
A weak strength for a constraint. This is weaker than MEDIUM but stronger than 0.0.
Sourcepub const ZERO: Strength
pub const ZERO: Strength
The weakest possible strength for a constraint. This is weaker than WEAK.
Sourcepub const fn new(value: f64) -> Self
pub const fn new(value: f64) -> Self
Create a new strength with the given value, clipped to the legal range (0.0, REQUIRED)
Sourcepub const fn create(
strong: f64,
medium: f64,
weak: f64,
multiplier: f64,
) -> Self
pub const fn create( strong: f64, medium: f64, weak: f64, multiplier: f64, ) -> Self
Create a constraint as a linear combination of STRONG, MEDIUM and WEAK strengths.
Each weight is multiplied by the multiplier, clamped to the legal range and then multiplied by the corresponding strength. The resulting strengths are then summed.
Sourcepub const fn add(self, rhs: Self) -> Self
pub const fn add(self, rhs: Self) -> Self
Add two strengths together, clamping the result to the legal range
Sourcepub const fn sub(self, rhs: Self) -> Self
pub const fn sub(self, rhs: Self) -> Self
Subtract one strength from another, clipping the result to the legal range
Sourcepub const fn mul_f64(self, rhs: f64) -> Self
pub const fn mul_f64(self, rhs: f64) -> Self
Multiply a strength by a scalar, clipping the result to the legal range
Sourcepub const fn mul_f32(self, rhs: f32) -> Self
pub const fn mul_f32(self, rhs: f32) -> Self
Multiply a strength by a scalar, clipping the result to the legal range
Trait Implementations§
Source§impl AddAssign for Strength
impl AddAssign for Strength
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Perform an in-place addition of two strengths, clipping the result to the legal range
Source§impl MulAssign<f64> for Strength
impl MulAssign<f64> for Strength
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Perform an in-place multiplication of a strength by a scalar, clipping the result to the legal range
Source§impl Ord for Strength
impl Ord for Strength
Source§impl PartialOrd for Strength
impl PartialOrd for Strength
Source§impl SubAssign for Strength
impl SubAssign for Strength
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Perform an in-place subtraction of two strengths, clipping the result to the legal range
impl Copy for Strength
impl Eq for Strength
impl StructuralPartialEq for Strength
Auto Trait Implementations§
impl Freeze for Strength
impl RefUnwindSafe for Strength
impl Send for Strength
impl Sync for Strength
impl Unpin for Strength
impl UnwindSafe for Strength
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.