Function extendr_api::functions::new_env

source ·
pub fn new_env(parent: Environment, hash: bool, capacity: i32) -> Environment
Expand description

Create a new environment

use extendr_api::prelude::*;
test! {
    let env: Environment = new_env(global_env(), true, 10).try_into().unwrap();
    env.set_local(sym!(x), "hello");
    assert_eq!(env.local(sym!(x)), Ok(r!("hello")));
}