Chapter 10 R Object - Environment

// #[rustr_export]
pub fn global()->RResult<EnvirN>{
    
    let rglobal = Envir::global();
    
    let pr :RFun = try!(rglobal.get("somefunction"));
    
    rprint(pr); // R print in Rust
    
    Ok(rglobal)
}
rust(code = '
// #[rustr_export]
pub fn global()->RResult<EnvirN>{
    
    let rglobal = Envir::global();
    
    let pr :RFun = try!(rglobal.get("somefunction"));
    
    rprint(pr); // R print in Rust
    
    Ok(rglobal)
}
')

global()
#> Error in eval(expr, envir, enclos): rustr error: cannot convert to function

somefunction = function(){1}

global()
#> function(){1}
#> <environment: R_GlobalEnv>

Also see the docs http://docs.rustr.org/rustr/environment/struct.EnvirM.html .