logo
pub trait Eval: GetSexp {
    fn eval(&self) -> Result<Robj> { ... }
fn eval_with_env(&self, env: &Environment) -> Result<Robj> { ... }
fn eval_blind(&self) -> Robj { ... } }

Provided methods

Evaluate the expression in R and return an error or an R object.

use extendr_api::prelude::*;
test! {

   let add = lang!("+", 1, 2);
   assert_eq!(add.eval().unwrap(), r!(3));
}

Evaluate the expression in R and return an error or an R object.

use extendr_api::prelude::*;
test! {

   let add = lang!("+", 1, 2);
   assert_eq!(add.eval_with_env(&global_env()).unwrap(), r!(3));
}

Evaluate the expression and return NULL or an R object.

use extendr_api::prelude::*;
test! {
   let bad = lang!("imnotavalidfunctioninR", 1, 2);
   assert_eq!(bad.eval_blind(), r!(NULL));
}

Implementors