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.
expression = term_1 + term_2 + ... + term_n + constantFields§
§terms: Vec<Term>The terms in the expression.
constant: f64The constant in the expression.
Implementations§
Source§impl Expression
impl Expression
Sourcepub const fn new(terms: Vec<Term>, constant: f64) -> Expression
pub const fn new(terms: Vec<Term>, constant: f64) -> Expression
Create a new Expression.
expression = term_1 + term_2 + ... + term_n + constantSourcepub const fn from_constant(constant: f64) -> Expression
pub const fn from_constant(constant: f64) -> Expression
Constructs an expression that represents a constant without any terms
expression = constantSourcepub fn from_term(term: Term) -> Expression
pub fn from_term(term: Term) -> Expression
Constructs an expression from a single term.
expression = termSourcepub const fn from_terms(terms: Vec<Term>) -> Expression
pub const fn from_terms(terms: Vec<Term>) -> Expression
Constructs an expression from a terms
expression = term_1 + term_2 + ... + term_nSourcepub fn from_variable(variable: Variable) -> Expression
pub fn from_variable(variable: Variable) -> Expression
Constructs an expression from a variable
expression = variableTrait 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, rhs: Expression) -> Expression
fn add(self, rhs: 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, expression: Expression) -> Expression
fn add(self, expression: 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, rhs: Expression) -> Expression
fn add(self, rhs: 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, rhs: Expression) -> Expression
fn add(self, rhs: 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, rhs: Expression) -> Expression
fn add(self, rhs: Expression) -> Expression
Performs the
+ operation. Read moreSource§impl AddAssign<Term> for Expression
impl AddAssign<Term> for Expression
Source§fn add_assign(&mut self, rhs: Term)
fn add_assign(&mut self, rhs: Term)
Performs the
+= operation. Read moreSource§impl AddAssign<Variable> for Expression
impl AddAssign<Variable> for Expression
Source§fn add_assign(&mut self, variable: Variable)
fn add_assign(&mut self, variable: Variable)
Performs the
+= operation. Read moreSource§impl AddAssign<f32> for Expression
impl AddAssign<f32> for Expression
Source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
Performs the
+= operation. Read moreSource§impl AddAssign<f64> for Expression
impl AddAssign<f64> for Expression
Source§fn add_assign(&mut self, rhs: f64)
fn add_assign(&mut self, rhs: f64)
Performs the
+= operation. Read moreSource§impl AddAssign for Expression
impl AddAssign for Expression
Source§fn add_assign(&mut self, rhs: Expression)
fn add_assign(&mut self, rhs: 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, rhs: WeightedRelation) -> PartialConstraint
fn bitor(self, rhs: 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 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 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 DivAssign<f32> for Expression
impl DivAssign<f32> for Expression
Source§fn div_assign(&mut self, v: f32)
fn div_assign(&mut self, v: f32)
Performs the
/= operation. Read moreSource§impl DivAssign<f64> for Expression
impl DivAssign<f64> for Expression
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/= operation. Read moreSource§impl From<Term> for Expression
impl From<Term> for Expression
Source§fn from(term: Term) -> Expression
fn from(term: Term) -> Expression
Converts to this type from the input type.
Source§impl From<Variable> for Expression
impl From<Variable> for Expression
Source§fn from(variable: Variable) -> Expression
fn from(variable: Variable) -> Expression
Converts to this type from the input type.
Source§impl From<f64> for Expression
impl From<f64> for Expression
Source§fn from(constant: f64) -> Expression
fn from(constant: f64) -> Expression
Converts to this type from the input type.
Source§impl FromIterator<Term> for Expression
impl FromIterator<Term> for Expression
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, rhs: Expression) -> Expression
fn mul(self, rhs: 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, rhs: Expression) -> Expression
fn mul(self, rhs: 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 MulAssign<f32> for Expression
impl MulAssign<f32> for Expression
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreSource§impl MulAssign<f64> for Expression
impl MulAssign<f64> for Expression
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*= operation. Read moreSource§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 PartialEq for Expression
impl PartialEq for Expression
Source§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, rhs: Expression) -> Expression
fn sub(self, rhs: 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, expression: Expression) -> Expression
fn sub(self, expression: 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, rhs: Expression) -> Expression
fn sub(self, rhs: 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, rhs: Expression) -> Expression
fn sub(self, rhs: 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, rhs: Expression) -> Expression
fn sub(self, rhs: Expression) -> Expression
Performs the
- operation. Read moreSource§impl SubAssign<Term> for Expression
impl SubAssign<Term> for Expression
Source§fn sub_assign(&mut self, rhs: Term)
fn sub_assign(&mut self, rhs: Term)
Performs the
-= operation. Read moreSource§impl SubAssign<Variable> for Expression
impl SubAssign<Variable> for Expression
Source§fn sub_assign(&mut self, variable: Variable)
fn sub_assign(&mut self, variable: Variable)
Performs the
-= operation. Read moreSource§impl SubAssign<f32> for Expression
impl SubAssign<f32> for Expression
Source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
Performs the
-= operation. Read moreSource§impl SubAssign<f64> for Expression
impl SubAssign<f64> for Expression
Source§fn sub_assign(&mut self, rhs: f64)
fn sub_assign(&mut self, rhs: f64)
Performs the
-= operation. Read moreSource§impl SubAssign for Expression
impl SubAssign for Expression
Source§fn sub_assign(&mut self, rhs: Expression)
fn sub_assign(&mut self, rhs: Expression)
Performs the
-= operation. Read moreimpl StructuralPartialEq for Expression
Auto 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