#eval #ruby #bindings #execute #mruby #i32 #trough

mruby-eval

A package to execute ruby code trough mruby bindings

1 unstable release

0.1.0 Oct 6, 2021

#9 in #mruby

MIT license

4KB
77 lines

mruby-eval

This is a package I made for another lib, but here's how to use it:

use mruby-eval::{eval_to, evaluators::eval_to_string};

eval_to_string("1+2") // returns an Option<String>, in this case Some(String::from("3"))

eval_to!(i32, "1+2") // eval_to!<type, expr> returns an Err<type, Parse#Error>
                     // (# in ParseError is the type, ex: ParseIntError)
                     //
                     // So in this case it's Ok(3)

No runtime deps

~0–1.9MB
~36K SLoC