Compile and evaluate one or more Rust expressions. If the last
expression in the Rust code returns a value (i.e., does not end with
;), then this value is returned to R. The value returned does not need
to be of type
Robj, as long as it can be cast into this type with
.into(). This conversion is done automatically, so you don't have to
worry about it in your code.
Input rust code.
The R environment in which the Rust code will be evaluated.
Other parameters handed off to
The return value generated by the Rust code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
## Not run: # Rust code without return value, called only for its side effects rust_eval( code = 'rprintln!("hello from Rust!");' ) # Rust code with return value rust_eval( code = " let x = 5; let y = 7; let z = x * y; z // return to R; rust_eval() takes care of type conversion code " ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.