pub trait Eval: GetSexp {
// Provided methods
fn eval(&self) -> Result<Robj> { ... }
fn eval_with_env(&self, env: &Environment) -> Result<Robj> { ... }
fn eval_blind(&self) -> Robj { ... }
}
Provided Methods§
Sourcefn eval(&self) -> Result<Robj>
fn eval(&self) -> Result<Robj>
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));
}
Sourcefn eval_with_env(&self, env: &Environment) -> Result<Robj>
fn eval_with_env(&self, env: &Environment) -> Result<Robj>
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));
}
Sourcefn eval_blind(&self) -> Robj
fn eval_blind(&self) -> Robj
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));
}