Function yard::evaluator::eval[][src]

pub fn eval<T: Num + FromStr + Clone + Into<f64>>(tokens: &[RPNToken<T>]) -> T
Expand description

eval process RPNToken provided by the parser and returned the value of the operation. #Example

extern crate yard;
use yard::{parser, evaluator};

fn main() {
    let code = "3 + 4";
    if let Ok(tokens) = parser::parse(&code) {
        let result = evaluator::eval::<i32>(&tokens);
        println!("{}", result);
    }
}

for normal usage, evaluate should be use instead.