Struct exprtk_rs::Expression [−][src]
pub struct Expression { /* fields omitted */ }
Methods
impl Expression
[src]
impl Expression
pub fn new(string: &str, symbols: SymbolTable) -> Result<Expression, ParseError>
[src]
pub fn new(string: &str, symbols: SymbolTable) -> Result<Expression, ParseError>
Compiles a new Expression
. Missing variables will lead to a
exprtk::ParseError
.
Example:
The above example melts down to this:
use exprtk_rs::*; let mut symbol_table = SymbolTable::new(); symbol_table.add_variable("a", 2.).unwrap(); let expr = Expression::new("a + 1", symbol_table).unwrap(); assert_eq!(expr.value(), 3.);
pub fn with_vars(
string: &str,
symbols: SymbolTable
) -> Result<(Expression, Vec<(String, usize)>), ParseError>
[src]
pub fn with_vars(
string: &str,
symbols: SymbolTable
) -> Result<(Expression, Vec<(String, usize)>), ParseError>
Compiles a new Expression
. Missing variables are automatically added to the SymbolTable
and initialized with 0.
. Their names and IDs are returned as tuple together with the
Expression
instance.
pub fn value(&self) -> c_double
[src]
pub fn value(&self) -> c_double
Calculates the value of the expression. Returns NaN
if the expression was not yet
compiled.
pub fn symbols(&mut self) -> &mut SymbolTable
[src]
pub fn symbols(&mut self) -> &mut SymbolTable
Trait Implementations
impl Send for Expression
[src]
impl Send for Expression
impl Drop for Expression
[src]
impl Drop for Expression
impl Debug for Expression
[src]
impl Debug for Expression
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Expression
[src]
impl Clone for Expression
fn clone(&self) -> Expression
[src]
fn clone(&self) -> Expression
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !Sync for Expression
impl !Sync for Expression