pub struct Expression {
pub terms: Vec<Term>,
pub constant: f64,
}
Expand description
An expression that can be the left hand or right hand side of a constraint equation. It is a linear combination of variables, i.e. a sum of variables weighted by coefficients, plus an optional constant.
Fields§
§terms: Vec<Term>
§constant: f64
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn from_constant(v: f64) -> Expression
pub fn from_constant(v: f64) -> Expression
Constructs an expression of the form n, where n is a constant real number, not a variable.
Sourcepub fn from_term(term: Term) -> Expression
pub fn from_term(term: Term) -> Expression
Constructs an expression from a single term. Forms an expression of the form n x where n is the coefficient, and x is the variable.
Trait Implementations§
Source§impl Add<Expression> for Term
impl Add<Expression> for Term
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§fn add(self, e: Expression) -> Expression
fn add(self, e: Expression) -> Expression
Performs the
+
operation. Read moreSource§impl Add<Expression> for Variable
impl Add<Expression> for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§fn add(self, e: Expression) -> Expression
fn add(self, e: Expression) -> Expression
Performs the
+
operation. Read moreSource§impl Add<Expression> for f32
impl Add<Expression> for f32
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§fn add(self, e: Expression) -> Expression
fn add(self, e: Expression) -> Expression
Performs the
+
operation. Read moreSource§impl Add<Expression> for f64
impl Add<Expression> for f64
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§fn add(self, e: Expression) -> Expression
fn add(self, e: Expression) -> Expression
Performs the
+
operation. Read moreSource§impl Add<Term> for Expression
impl Add<Term> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§impl Add<Variable> for Expression
impl Add<Variable> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§impl Add<f32> for Expression
impl Add<f32> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§impl Add<f64> for Expression
impl Add<f64> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§impl Add for Expression
impl Add for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+
operator.Source§fn add(self, e: Expression) -> Expression
fn add(self, e: Expression) -> Expression
Performs the
+
operation. Read moreSource§impl BitOr<Expression> for PartialConstraint
impl BitOr<Expression> for PartialConstraint
Source§type Output = Constraint
type Output = Constraint
The resulting type after applying the
|
operator.Source§fn bitor(self, rhs: Expression) -> Constraint
fn bitor(self, rhs: Expression) -> Constraint
Performs the
|
operation. Read moreSource§impl BitOr<WeightedRelation> for Expression
impl BitOr<WeightedRelation> for Expression
Source§type Output = PartialConstraint
type Output = PartialConstraint
The resulting type after applying the
|
operator.Source§fn bitor(self, r: WeightedRelation) -> PartialConstraint
fn bitor(self, r: WeightedRelation) -> PartialConstraint
Performs the
|
operation. Read moreSource§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a copy 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 Debug for Expression
impl Debug for Expression
Source§impl Div<f32> for Expression
impl Div<f32> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
/
operator.Source§impl Div<f64> for Expression
impl Div<f64> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
/
operator.Source§impl From<Term> for Expression
impl From<Term> for Expression
Source§fn from(t: Term) -> Expression
fn from(t: Term) -> Expression
Converts to this type from the input type.
Source§impl From<Variable> for Expression
impl From<Variable> for Expression
Source§fn from(v: Variable) -> Expression
fn from(v: Variable) -> Expression
Converts to this type from the input type.
Source§impl From<f64> for Expression
impl From<f64> for Expression
Source§fn from(v: f64) -> Expression
fn from(v: f64) -> Expression
Converts to this type from the input type.
Source§impl Mul<Expression> for f32
impl Mul<Expression> for f32
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
*
operator.Source§fn mul(self, e: Expression) -> Expression
fn mul(self, e: Expression) -> Expression
Performs the
*
operation. Read moreSource§impl Mul<Expression> for f64
impl Mul<Expression> for f64
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
*
operator.Source§fn mul(self, e: Expression) -> Expression
fn mul(self, e: Expression) -> Expression
Performs the
*
operation. Read moreSource§impl Mul<f32> for Expression
impl Mul<f32> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
*
operator.Source§impl Mul<f64> for Expression
impl Mul<f64> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
*
operator.Source§impl Neg for Expression
impl Neg for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§fn neg(self) -> Expression
fn neg(self) -> Expression
Performs the unary
-
operation. Read moreSource§impl Sub<Expression> for Term
impl Sub<Expression> for Term
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§fn sub(self, e: Expression) -> Expression
fn sub(self, e: Expression) -> Expression
Performs the
-
operation. Read moreSource§impl Sub<Expression> for Variable
impl Sub<Expression> for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§fn sub(self, e: Expression) -> Expression
fn sub(self, e: Expression) -> Expression
Performs the
-
operation. Read moreSource§impl Sub<Expression> for f32
impl Sub<Expression> for f32
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§fn sub(self, e: Expression) -> Expression
fn sub(self, e: Expression) -> Expression
Performs the
-
operation. Read moreSource§impl Sub<Expression> for f64
impl Sub<Expression> for f64
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§fn sub(self, e: Expression) -> Expression
fn sub(self, e: Expression) -> Expression
Performs the
-
operation. Read moreSource§impl Sub<Term> for Expression
impl Sub<Term> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§impl Sub<Variable> for Expression
impl Sub<Variable> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§impl Sub<f32> for Expression
impl Sub<f32> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§impl Sub<f64> for Expression
impl Sub<f64> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§impl Sub for Expression
impl Sub for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
-
operator.Source§fn sub(self, e: Expression) -> Expression
fn sub(self, e: Expression) -> Expression
Performs the
-
operation. Read moreAuto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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