Struct cassowary::Expression
[−]
[src]
pub struct Expression { pub terms: Vec<Term>, pub constant: f64, }
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
Methods
impl Expression
[src]
fn from_constant(v: f64) -> Expression
Constructs an expression of the form n, where n is a constant real number, not a variable.
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.
fn new(terms: Vec<Term>, constant: f64) -> Expression
General constructor. Each Term
in terms
is part of the sum forming the expression, as well as constant
.
fn negate(&mut self)
Mutates this expression by multiplying it by minus one.
Trait Implementations
impl BitOr<WeightedRelation> for Expression
[src]
type Output = PartialConstraint
The resulting type after applying the |
operator
fn bitor(self, r: WeightedRelation) -> PartialConstraint
The method for the |
operator
impl Add<Variable> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator
fn add(self, v: Variable) -> Expression
The method for the +
operator
impl Sub<Variable> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator
fn sub(self, v: Variable) -> Expression
The method for the -
operator
impl Add<Term> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator
fn add(self, t: Term) -> Expression
The method for the +
operator
impl Sub<Term> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator
fn sub(self, t: Term) -> Expression
The method for the -
operator
impl Mul<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the *
operator
fn mul(self, v: f64) -> Expression
The method for the *
operator
impl Div<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the /
operator
fn div(self, v: f64) -> Expression
The method for the /
operator
impl Add<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator
fn add(self, v: f64) -> Expression
The method for the +
operator
impl Add<Expression> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator
fn add(self, e: Expression) -> Expression
The method for the +
operator
impl Neg for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator
fn neg(self) -> Expression
The method for the unary -
operator
impl Sub<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator
fn sub(self, v: f64) -> Expression
The method for the -
operator
impl Sub<Expression> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator
fn sub(self, e: Expression) -> Expression
The method for the -
operator
impl Clone for Expression
[src]
fn clone(&self) -> Expression
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Expression
[src]
impl From<f64> for Expression
[src]
fn from(v: f64) -> Expression
Performs the conversion.
impl From<Variable> for Expression
[src]
fn from(v: Variable) -> Expression
Performs the conversion.
impl From<Term> for Expression
[src]
fn from(t: Term) -> Expression
Performs the conversion.