pub struct Constraint<T> { /* private fields */ }Expand description
A constraint, consisting of an equation governed by an expression and a relational operator, and an associated strength.
Implementations§
Source§impl<T> Constraint<T>
impl<T> Constraint<T>
Sourcepub fn new(
e: Expression<T>,
op: RelationalOperator,
strength: f64,
) -> Constraint<T>
pub fn new( e: Expression<T>, op: RelationalOperator, strength: f64, ) -> Constraint<T>
Construct a new constraint from an expression, a relational operator and a strength.
This corresponds to the equation e op 0.0, e.g. x + y >= 0.0. For equations with a non-zero
right hand side, subtract it from the equation to give a zero right hand side.
Sourcepub fn expr(&self) -> &Expression<T>
pub fn expr(&self) -> &Expression<T>
The expression of the left hand side of the constraint equation.
Sourcepub fn op(&self) -> RelationalOperator
pub fn op(&self) -> RelationalOperator
The relational operator governing the constraint.
Sourcepub fn with_strength(self, s: f64) -> Self
pub fn with_strength(self, s: f64) -> Self
Set the strength in builder-style
Trait Implementations§
Source§impl<T: Clone> Clone for Constraint<T>
impl<T: Clone> Clone for Constraint<T>
Source§fn clone(&self) -> Constraint<T>
fn clone(&self) -> Constraint<T>
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 moreSource§impl<T: Debug> Debug for Constraint<T>
impl<T: Debug> Debug for Constraint<T>
Source§impl<T: Hash> Hash for Constraint<T>
impl<T: Hash> Hash for Constraint<T>
Source§impl<T: PartialEq> PartialEq for Constraint<T>
impl<T: PartialEq> PartialEq for Constraint<T>
impl<T: Eq> Eq for Constraint<T>
impl<T> StructuralPartialEq for Constraint<T>
Auto Trait Implementations§
impl<T> Freeze for Constraint<T>
impl<T> RefUnwindSafe for Constraint<T>where
T: RefUnwindSafe,
impl<T> Send for Constraint<T>where
T: Send,
impl<T> Sync for Constraint<T>where
T: Sync,
impl<T> Unpin for Constraint<T>where
T: Unpin,
impl<T> UnwindSafe for Constraint<T>where
T: 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