Function yard::evaluate[][src]

pub fn evaluate<T>(code: &str) -> Result<T, String> where
    T: Num + FromStr + Clone + Into<f64>, 
Expand description

evaluate is a wrapper reducing the amount of code needed to process a string. #Example


fn main() {
    let code = "3 + 4";
    if let Ok(total) = yard::evaluate::<i32>(&code) {
        println!("{}", total);
    }
}