pub enum NumExpr<T: NumType> {
Const(T),
Var(usize),
Add(Box<NumExpr<T>>, Box<NumExpr<T>>),
Sub(Box<NumExpr<T>>, Box<NumExpr<T>>),
Mul(Box<NumExpr<T>>, Box<NumExpr<T>>),
Div(Box<NumExpr<T>>, Box<NumExpr<T>>),
Divz(Box<NumExpr<T>>, Box<NumExpr<T>>),
Recip(Box<NumExpr<T>>),
Recipz(Box<NumExpr<T>>),
}
Expand description
An expression evaluates to a numeric value of type NumType
.
Variants§
Const(T)
A constant value.
Var(usize)
References a variable by position
Add(Box<NumExpr<T>>, Box<NumExpr<T>>)
Sub(Box<NumExpr<T>>, Box<NumExpr<T>>)
Mul(Box<NumExpr<T>>, Box<NumExpr<T>>)
Div(Box<NumExpr<T>>, Box<NumExpr<T>>)
Divz(Box<NumExpr<T>>, Box<NumExpr<T>>)
Safe division with x/0 = 0.0
Recip(Box<NumExpr<T>>)
Reciprocal (1 / x).
Recipz(Box<NumExpr<T>>)
Reciprocal using safe division
Implementations§
Source§impl<T: NumType> NumExpr<T>
impl<T: NumType> NumExpr<T>
pub fn op_add(self, other: NumExpr<T>) -> NumExpr<T>
pub fn op_sub(self, other: NumExpr<T>) -> NumExpr<T>
pub fn op_mul(self, other: NumExpr<T>) -> NumExpr<T>
pub fn op_div(self, other: NumExpr<T>) -> NumExpr<T>
pub fn op_divz(self, other: NumExpr<T>) -> NumExpr<T>
pub fn op_recip(self) -> NumExpr<T>
pub fn op_recipz(self) -> NumExpr<T>
Trait Implementations§
Source§impl<T: NumType> Expression for NumExpr<T>
impl<T: NumType> Expression for NumExpr<T>
impl<T: Eq + NumType> Eq for NumExpr<T>
impl<T: NumType> StructuralPartialEq for NumExpr<T>
Auto Trait Implementations§
impl<T> Freeze for NumExpr<T>where
T: Freeze,
impl<T> RefUnwindSafe for NumExpr<T>where
T: RefUnwindSafe,
impl<T> Send for NumExpr<T>where
T: Send,
impl<T> Sync for NumExpr<T>where
T: Sync,
impl<T> Unpin for NumExpr<T>where
T: Unpin,
impl<T> UnwindSafe for NumExpr<T>where
T: UnwindSafe,
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