Term

Struct Term 

Source
pub struct Term<T> {
    pub variable: T,
    pub coefficient: OrderedFloat<f64>,
}
Expand description

A variable and a coefficient to multiply that variable by. This is a sub-expression in a constraint equation.

Fields§

§variable: T§coefficient: OrderedFloat<f64>

Implementations§

Source§

impl<T> Term<T>

Source

pub fn new(variable: T, coefficient: f64) -> Term<T>

Construct a new Term from a variable and a coefficient.

Trait Implementations§

Source§

impl<T> Add<Expression<T>> for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

fn add(self, e: Expression<T>) -> Expression<T>

Performs the + operation. Read more
Source§

impl<T> Add<Term<T>> for Expression<T>

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Clone> Add<Term<T>> for f32

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Clone> Add<Term<T>> for f64

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Term<Variable>> for Variable

Source§

type Output = Expression<Variable>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Variable> for Term<Variable>

Source§

type Output = Expression<Variable>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Clone> Add<f32> for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Clone> Add<f64> for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Clone> Add for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> AddAssign<Term<T>> for Expression<T>

Source§

fn add_assign(&mut self, t: Term<T>)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Term<T>

Source§

fn clone(&self) -> Term<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Term<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Div<f32> for Term<T>

Source§

type Output = Term<T>

The resulting type after applying the / operator.
Source§

fn div(self, v: f32) -> Term<T>

Performs the / operation. Read more
Source§

impl<T> Div<f64> for Term<T>

Source§

type Output = Term<T>

The resulting type after applying the / operator.
Source§

fn div(self, v: f64) -> Term<T>

Performs the / operation. Read more
Source§

impl<T> DivAssign<f32> for Term<T>

Source§

fn div_assign(&mut self, v: f32)

Performs the /= operation. Read more
Source§

impl<T> DivAssign<f64> for Term<T>

Source§

fn div_assign(&mut self, v: f64)

Performs the /= operation. Read more
Source§

impl<T: Clone> From<Term<T>> for Expression<T>

Source§

fn from(t: Term<T>) -> Expression<T>

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Term<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Mul<Term<T>> for f32

Source§

type Output = Term<T>

The resulting type after applying the * operator.
Source§

fn mul(self, t: Term<T>) -> Term<T>

Performs the * operation. Read more
Source§

impl<T> Mul<Term<T>> for f64

Source§

type Output = Term<T>

The resulting type after applying the * operator.
Source§

fn mul(self, t: Term<T>) -> Term<T>

Performs the * operation. Read more
Source§

impl<T> Mul<f32> for Term<T>

Source§

type Output = Term<T>

The resulting type after applying the * operator.
Source§

fn mul(self, v: f32) -> Term<T>

Performs the * operation. Read more
Source§

impl<T> Mul<f64> for Term<T>

Source§

type Output = Term<T>

The resulting type after applying the * operator.
Source§

fn mul(self, v: f64) -> Term<T>

Performs the * operation. Read more
Source§

impl<T> MulAssign<f32> for Term<T>

Source§

fn mul_assign(&mut self, v: f32)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<f64> for Term<T>

Source§

fn mul_assign(&mut self, v: f64)

Performs the *= operation. Read more
Source§

impl<T> Neg for Term<T>

Source§

type Output = Term<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Term<T>

Performs the unary - operation. Read more
Source§

impl<T: PartialEq> PartialEq for Term<T>

Source§

fn eq(&self, other: &Term<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Clone> Sub<Expression<T>> for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

fn sub(self, e: Expression<T>) -> Expression<T>

Performs the - operation. Read more
Source§

impl<T> Sub<Term<T>> for Expression<T>

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Clone> Sub<Term<T>> for f32

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Clone> Sub<Term<T>> for f64

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Term<Variable>> for Variable

Source§

type Output = Expression<Variable>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Variable> for Term<Variable>

Source§

type Output = Expression<Variable>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Clone> Sub<f32> for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Clone> Sub<f64> for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Clone> Sub for Term<T>

Source§

type Output = Expression<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> SubAssign<Term<T>> for Expression<T>

Source§

fn sub_assign(&mut self, t: Term<T>)

Performs the -= operation. Read more
Source§

impl<T: Copy> Copy for Term<T>

Source§

impl<T: Eq> Eq for Term<T>

Source§

impl<T> StructuralPartialEq for Term<T>

Auto Trait Implementations§

§

impl<T> Freeze for Term<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Term<T>
where T: RefUnwindSafe,

§

impl<T> Send for Term<T>
where T: Send,

§

impl<T> Sync for Term<T>
where T: Sync,

§

impl<T> Unpin for Term<T>
where T: Unpin,

§

impl<T> UnwindSafe for Term<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.