rscel 1.0.8

Cel interpreter in rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rscel::{BindContext, CelContext};
use std::env;

fn main() {
    let args: Vec<String> = env::args().collect();
    let mut context = CelContext::new();
    let mut exec = BindContext::new();

    context.add_program_str("prog", &args[1]).unwrap();

    if args.len() > 2 {
        exec.bind_params_from_json_obj(args[2].parse().unwrap())
            .unwrap();
    }

    let res = context.exec("prog", &exec).unwrap();
    println!("{}", res);
}