pub enum Primary {
Integer(Integer),
Float(Float),
Symbol(String),
Call(String, Vec<SymExpr>),
}Expand description
A single term / factor, such as a number, variable, or function call.
Variants§
Integer(Integer)
An integer, such as 2 or 144.
Float(Float)
A floating-point number, such as 3.14 or 0.5.
Symbol(String)
A variable, such as x or y.
Call(String, Vec<SymExpr>)
A function call, such as sin(x) or f(x, y).
Trait Implementations§
Source§impl Add for Primary
Adds two Primarys together. If both are the same numeric type, the numbers are added
together. Otherwise, the two Primarys are wrapped in a SymExpr::Add.
impl Add for Primary
Adds two Primarys together. If both are the same numeric type, the numbers are added
together. Otherwise, the two Primarys are wrapped in a SymExpr::Add.
Note this means that adding an Integer and a Float will result in a
SymExpr::Add.
Source§impl Hash for Primary
Hash is implemented manually to allow hashing Primary::Floats. This module must
never produce non-normal Floats (such as NaN or Infinity)! Report any bugs that cause
this to happen.
impl Hash for Primary
Hash is implemented manually to allow hashing Primary::Floats. This module must
never produce non-normal Floats (such as NaN or Infinity)! Report any bugs that cause
this to happen.
Source§impl Mul for Primary
Multiplies two Primarys together. If both are the same numeric type, the numbers are
multiplied together. Otherwise, the two Primarys are wrapped in a SymExpr::Mul.
impl Mul for Primary
Multiplies two Primarys together. If both are the same numeric type, the numbers are
multiplied together. Otherwise, the two Primarys are wrapped in a SymExpr::Mul.
Note this means that multiplying an Integer and a Float will result in a
SymExpr::Mul.
impl Eq for Primary
Eq is implemented manually to allow comparing Primary::Integer and Primary::Floats.
This module must never produce non-normal Floats (such as NaN or Infinity)! Report
any bugs that cause this to happen.