extendr_api::functions

Function 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")));
}