pub struct Expression {
pub terms: Vec<Term>,
pub constant: f64,
}Expand description
A linear expression: Σ coefficient·variable + constant.
Fields§
§terms: Vec<Term>Weighted variable terms.
constant: f64Constant offset.
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn new(terms: Vec<Term>, constant: f64) -> Self
pub fn new(terms: Vec<Term>, constant: f64) -> Self
Construct from an explicit list of terms and a constant.
Sourcepub fn from_constant(c: f64) -> Self
pub fn from_constant(c: f64) -> Self
A constant expression with no variables.
Sourcepub fn from_variable(v: Variable) -> Self
pub fn from_variable(v: Variable) -> Self
An expression representing a single variable with coefficient 1.0.
Trait Implementations§
Source§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 (const: unstable) · 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 Default for Expression
impl Default for Expression
Source§fn default() -> Expression
fn default() -> Expression
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnsafeUnpin 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