26 lines
560 B
Rust
26 lines
560 B
Rust
#![allow(dead_code)]
|
|
|
|
use nix_js::context::Context;
|
|
use nix_js::error::{Result, Source};
|
|
use nix_js::value::Value;
|
|
|
|
pub fn eval(expr: &str) -> Value {
|
|
Context::new()
|
|
.unwrap()
|
|
.eval(Source::new_eval(expr.into()).unwrap())
|
|
.unwrap()
|
|
}
|
|
|
|
pub fn eval_result(expr: &str) -> Result<Value> {
|
|
Context::new()
|
|
.unwrap()
|
|
.eval(Source::new_eval(expr.into()).unwrap())
|
|
}
|
|
|
|
pub fn compile(expr: &str) -> String {
|
|
Context::new()
|
|
.unwrap()
|
|
.compile(Source::new_eval(expr.into()).unwrap())
|
|
.unwrap()
|
|
}
|