# Struct cassowary::Expression
[−]
[src]

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]

`impl Expression`

`pub fn from_constant(v: f64) -> Expression`

[src]

`pub fn from_constant(v: f64) -> Expression`

Constructs an expression of the form *n*, where n is a constant real number, not a variable.

`pub fn from_term(term: Term) -> Expression`

[src]

`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.

`pub fn new(terms: Vec<Term>, constant: f64) -> Expression`

[src]

`pub 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`

.

`pub fn negate(&mut self)`

[src]

`pub fn negate(&mut self)`

Mutates this expression by multiplying it by minus one.

## Trait Implementations

`impl BitOr<WeightedRelation> for Expression`

[src]

`impl BitOr<WeightedRelation> for Expression`

`type Output = PartialConstraint`

The resulting type after applying the `|`

operator.

`fn bitor(self, r: WeightedRelation) -> PartialConstraint`

[src]

`fn bitor(self, r: WeightedRelation) -> PartialConstraint`

Performs the `|`

operation.

`impl BitOr<Expression> for PartialConstraint`

[src]

`impl BitOr<Expression> for PartialConstraint`

`type Output = Constraint`

The resulting type after applying the `|`

operator.

`fn bitor(self, rhs: Expression) -> Constraint`

[src]

`fn bitor(self, rhs: Expression) -> Constraint`

Performs the `|`

operation.

`impl Add<Expression> for Variable`

[src]

`impl Add<Expression> for Variable`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, e: Expression) -> Expression`

[src]

`fn add(self, e: Expression) -> Expression`

Performs the `+`

operation.

`impl Add<Variable> for Expression`

[src]

`impl Add<Variable> for Expression`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, v: Variable) -> Expression`

[src]

`fn add(self, v: Variable) -> Expression`

Performs the `+`

operation.

`impl AddAssign<Variable> for Expression`

[src]

`impl AddAssign<Variable> for Expression`

`fn add_assign(&mut self, v: Variable)`

[src]

`fn add_assign(&mut self, v: Variable)`

Performs the `+=`

operation.

`impl Sub<Expression> for Variable`

[src]

`impl Sub<Expression> for Variable`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, e: Expression) -> Expression`

[src]

`fn sub(self, e: Expression) -> Expression`

Performs the `-`

operation.

`impl Sub<Variable> for Expression`

[src]

`impl Sub<Variable> for Expression`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, v: Variable) -> Expression`

[src]

`fn sub(self, v: Variable) -> Expression`

Performs the `-`

operation.

`impl SubAssign<Variable> for Expression`

[src]

`impl SubAssign<Variable> for Expression`

`fn sub_assign(&mut self, v: Variable)`

[src]

`fn sub_assign(&mut self, v: Variable)`

Performs the `-=`

operation.

`impl Add<Expression> for Term`

[src]

`impl Add<Expression> for Term`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, e: Expression) -> Expression`

[src]

`fn add(self, e: Expression) -> Expression`

Performs the `+`

operation.

`impl Add<Term> for Expression`

[src]

`impl Add<Term> for Expression`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, t: Term) -> Expression`

[src]

`fn add(self, t: Term) -> Expression`

Performs the `+`

operation.

`impl AddAssign<Term> for Expression`

[src]

`impl AddAssign<Term> for Expression`

`fn add_assign(&mut self, t: Term)`

[src]

`fn add_assign(&mut self, t: Term)`

Performs the `+=`

operation.

`impl Sub<Expression> for Term`

[src]

`impl Sub<Expression> for Term`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, e: Expression) -> Expression`

[src]

`fn sub(self, e: Expression) -> Expression`

Performs the `-`

operation.

`impl Sub<Term> for Expression`

[src]

`impl Sub<Term> for Expression`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, t: Term) -> Expression`

[src]

`fn sub(self, t: Term) -> Expression`

Performs the `-`

operation.

`impl SubAssign<Term> for Expression`

[src]

`impl SubAssign<Term> for Expression`

`fn sub_assign(&mut self, t: Term)`

[src]

`fn sub_assign(&mut self, t: Term)`

Performs the `-=`

operation.

`impl Mul<f64> for Expression`

[src]

`impl Mul<f64> for Expression`

`type Output = Expression`

The resulting type after applying the `*`

operator.

`fn mul(self, v: f64) -> Expression`

[src]

`fn mul(self, v: f64) -> Expression`

Performs the `*`

operation.

`impl MulAssign<f64> for Expression`

[src]

`impl MulAssign<f64> for Expression`

`fn mul_assign(&mut self, v: f64)`

[src]

`fn mul_assign(&mut self, v: f64)`

Performs the `*=`

operation.

`impl Mul<f32> for Expression`

[src]

`impl Mul<f32> for Expression`

`type Output = Expression`

The resulting type after applying the `*`

operator.

`fn mul(self, v: f32) -> Expression`

[src]

`fn mul(self, v: f32) -> Expression`

Performs the `*`

operation.

`impl MulAssign<f32> for Expression`

[src]

`impl MulAssign<f32> for Expression`

`fn mul_assign(&mut self, v: f32)`

[src]

`fn mul_assign(&mut self, v: f32)`

Performs the `*=`

operation.

`impl Mul<Expression> for f64`

[src]

`impl Mul<Expression> for f64`

`type Output = Expression`

The resulting type after applying the `*`

operator.

`fn mul(self, e: Expression) -> Expression`

[src]

`fn mul(self, e: Expression) -> Expression`

Performs the `*`

operation.

`impl Mul<Expression> for f32`

[src]

`impl Mul<Expression> for f32`

`type Output = Expression`

The resulting type after applying the `*`

operator.

`fn mul(self, e: Expression) -> Expression`

[src]

`fn mul(self, e: Expression) -> Expression`

Performs the `*`

operation.

`impl Div<f64> for Expression`

[src]

`impl Div<f64> for Expression`

`type Output = Expression`

The resulting type after applying the `/`

operator.

`fn div(self, v: f64) -> Expression`

[src]

`fn div(self, v: f64) -> Expression`

Performs the `/`

operation.

`impl DivAssign<f64> for Expression`

[src]

`impl DivAssign<f64> for Expression`

`fn div_assign(&mut self, v: f64)`

[src]

`fn div_assign(&mut self, v: f64)`

Performs the `/=`

operation.

`impl Div<f32> for Expression`

[src]

`impl Div<f32> for Expression`

`type Output = Expression`

The resulting type after applying the `/`

operator.

`fn div(self, v: f32) -> Expression`

[src]

`fn div(self, v: f32) -> Expression`

Performs the `/`

operation.

`impl DivAssign<f32> for Expression`

[src]

`impl DivAssign<f32> for Expression`

`fn div_assign(&mut self, v: f32)`

[src]

`fn div_assign(&mut self, v: f32)`

Performs the `/=`

operation.

`impl Add<f64> for Expression`

[src]

`impl Add<f64> for Expression`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, v: f64) -> Expression`

[src]

`fn add(self, v: f64) -> Expression`

Performs the `+`

operation.

`impl AddAssign<f64> for Expression`

[src]

`impl AddAssign<f64> for Expression`

`fn add_assign(&mut self, v: f64)`

[src]

`fn add_assign(&mut self, v: f64)`

Performs the `+=`

operation.

`impl Add<f32> for Expression`

[src]

`impl Add<f32> for Expression`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, v: f32) -> Expression`

[src]

`fn add(self, v: f32) -> Expression`

Performs the `+`

operation.

`impl AddAssign<f32> for Expression`

[src]

`impl AddAssign<f32> for Expression`

`fn add_assign(&mut self, v: f32)`

[src]

`fn add_assign(&mut self, v: f32)`

Performs the `+=`

operation.

`impl Add<Expression> for f64`

[src]

`impl Add<Expression> for f64`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, e: Expression) -> Expression`

[src]

`fn add(self, e: Expression) -> Expression`

Performs the `+`

operation.

`impl Add<Expression> for f32`

[src]

`impl Add<Expression> for f32`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, e: Expression) -> Expression`

[src]

`fn add(self, e: Expression) -> Expression`

Performs the `+`

operation.

`impl Add<Expression> for Expression`

[src]

`impl Add<Expression> for Expression`

`type Output = Expression`

The resulting type after applying the `+`

operator.

`fn add(self, e: Expression) -> Expression`

[src]

`fn add(self, e: Expression) -> Expression`

Performs the `+`

operation.

`impl AddAssign<Expression> for Expression`

[src]

`impl AddAssign<Expression> for Expression`

`fn add_assign(&mut self, e: Expression)`

[src]

`fn add_assign(&mut self, e: Expression)`

Performs the `+=`

operation.

`impl Neg for Expression`

[src]

`impl Neg for Expression`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn neg(self) -> Expression`

[src]

`fn neg(self) -> Expression`

Performs the unary `-`

operation.

`impl Sub<f64> for Expression`

[src]

`impl Sub<f64> for Expression`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, v: f64) -> Expression`

[src]

`fn sub(self, v: f64) -> Expression`

Performs the `-`

operation.

`impl SubAssign<f64> for Expression`

[src]

`impl SubAssign<f64> for Expression`

`fn sub_assign(&mut self, v: f64)`

[src]

`fn sub_assign(&mut self, v: f64)`

Performs the `-=`

operation.

`impl Sub<f32> for Expression`

[src]

`impl Sub<f32> for Expression`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, v: f32) -> Expression`

[src]

`fn sub(self, v: f32) -> Expression`

Performs the `-`

operation.

`impl SubAssign<f32> for Expression`

[src]

`impl SubAssign<f32> for Expression`

`fn sub_assign(&mut self, v: f32)`

[src]

`fn sub_assign(&mut self, v: f32)`

Performs the `-=`

operation.

`impl Sub<Expression> for f64`

[src]

`impl Sub<Expression> for f64`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, e: Expression) -> Expression`

[src]

`fn sub(self, e: Expression) -> Expression`

Performs the `-`

operation.

`impl Sub<Expression> for f32`

[src]

`impl Sub<Expression> for f32`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, e: Expression) -> Expression`

[src]

`fn sub(self, e: Expression) -> Expression`

Performs the `-`

operation.

`impl Sub<Expression> for Expression`

[src]

`impl Sub<Expression> for Expression`

`type Output = Expression`

The resulting type after applying the `-`

operator.

`fn sub(self, e: Expression) -> Expression`

[src]

`fn sub(self, e: Expression) -> Expression`

Performs the `-`

operation.

`impl SubAssign<Expression> for Expression`

[src]

`impl SubAssign<Expression> for Expression`

`fn sub_assign(&mut self, e: Expression)`

[src]

`fn sub_assign(&mut self, e: Expression)`

Performs the `-=`

operation.

`impl Clone for Expression`

[src]

`impl Clone for Expression`

`fn clone(&self) -> Expression`

[src]

`fn clone(&self) -> Expression`

Returns a copy of the value. Read more

`fn clone_from(&mut self, source: &Self)`

1.0.0[src]

`fn clone_from(&mut self, source: &Self)`

Performs copy-assignment from `source`

. Read more

`impl Debug for Expression`

[src]

`impl Debug for Expression`

`fn fmt(&self, __arg_0: &mut Formatter) -> Result`

[src]

`fn fmt(&self, __arg_0: &mut Formatter) -> Result`

Formats the value using the given formatter. Read more

`impl From<f64> for Expression`

[src]

`impl From<f64> for Expression`

`fn from(v: f64) -> Expression`

[src]

`fn from(v: f64) -> Expression`

Performs the conversion.

`impl From<Variable> for Expression`

[src]

`impl From<Variable> for Expression`

`fn from(v: Variable) -> Expression`

[src]

`fn from(v: Variable) -> Expression`

Performs the conversion.

`impl From<Term> for Expression`

[src]

`impl From<Term> for Expression`

`fn from(t: Term) -> Expression`

[src]

`fn from(t: Term) -> Expression`

Performs the conversion.

## Auto Trait Implementations

`impl Send for Expression`

`impl Send for Expression`

`impl Sync for Expression`

`impl Sync for Expression`