Struct casuarius::Constraint
source · [−]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
sourceimpl<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
sourceimpl<T: Clone> Clone for Constraint<T>
impl<T: Clone> Clone for Constraint<T>
sourcefn clone(&self) -> Constraint<T>
fn clone(&self) -> Constraint<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug> Debug for Constraint<T>
impl<T: Debug> Debug for Constraint<T>
sourceimpl<T: Hash> Hash for Constraint<T>
impl<T: Hash> Hash for Constraint<T>
sourceimpl<T: PartialEq> PartialEq<Constraint<T>> for Constraint<T>
impl<T: PartialEq> PartialEq<Constraint<T>> for Constraint<T>
sourcefn eq(&self, other: &Constraint<T>) -> bool
fn eq(&self, other: &Constraint<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl<T: Eq> Eq for Constraint<T>
impl<T> StructuralEq for Constraint<T>
impl<T> StructuralPartialEq for Constraint<T>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more