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
[src]
Constructs an expression of the form n, where n is a constant real number, not a variable.
fn from_term(term: Term) -> Expression
[src]
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
[src]
General constructor. Each Term
in terms
is part of the sum forming the expression, as well as constant
.
fn negate(&mut self)
[src]
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
[src]
Performs the |
operation.
impl Add<Variable> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator.
fn add(self, v: Variable) -> Expression
[src]
Performs the +
operation.
impl Sub<Variable> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator.
fn sub(self, v: Variable) -> Expression
[src]
Performs the -
operation.
impl Add<Term> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator.
fn add(self, t: Term) -> Expression
[src]
Performs the +
operation.
impl Sub<Term> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator.
fn sub(self, t: Term) -> Expression
[src]
Performs the -
operation.
impl Mul<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the *
operator.
fn mul(self, v: f64) -> Expression
[src]
Performs the *
operation.
impl Mul<f32> for Expression
[src]
type Output = Expression
The resulting type after applying the *
operator.
fn mul(self, v: f32) -> Expression
[src]
Performs the *
operation.
impl Div<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the /
operator.
fn div(self, v: f64) -> Expression
[src]
Performs the /
operation.
impl Div<f32> for Expression
[src]
type Output = Expression
The resulting type after applying the /
operator.
fn div(self, v: f32) -> Expression
[src]
Performs the /
operation.
impl Add<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator.
fn add(self, v: f64) -> Expression
[src]
Performs the +
operation.
impl Add<f32> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator.
fn add(self, v: f32) -> Expression
[src]
Performs the +
operation.
impl Add<Expression> for Expression
[src]
type Output = Expression
The resulting type after applying the +
operator.
fn add(self, e: Expression) -> Expression
[src]
Performs the +
operation.
impl Neg for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator.
fn neg(self) -> Expression
[src]
Performs the unary -
operation.
impl Sub<f64> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator.
fn sub(self, v: f64) -> Expression
[src]
Performs the -
operation.
impl Sub<f32> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator.
fn sub(self, v: f32) -> Expression
[src]
Performs the -
operation.
impl Sub<Expression> for Expression
[src]
type Output = Expression
The resulting type after applying the -
operator.
fn sub(self, e: Expression) -> Expression
[src]
Performs the -
operation.
impl Clone for Expression
[src]
fn clone(&self) -> Expression
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Expression
[src]
impl From<f64> for Expression
[src]
fn from(v: f64) -> Expression
[src]
Performs the conversion.
impl From<Variable> for Expression
[src]
fn from(v: Variable) -> Expression
[src]
Performs the conversion.
impl From<Term> for Expression
[src]
fn from(t: Term) -> Expression
[src]
Performs the conversion.