Skip to content

Wrapper function of the resolver crate. Provides python-like built-in functions.

License

Notifications You must be signed in to change notification settings

floating-floaties/eval-utility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eval Utility

About

Wrapper function of the resolver crate. Provides python-like built-in functions.

Install

Add the following line to your Cargo.toml file (under [dependencies]):

eval-utility = "0.2"

Example

See test cases in lib.rs for more examples.

use eval_utility::eval_wrapper::{EvalConfig, ExprWrapper};

fn main() {
    let expression = "float('42.42') == 42.42";
    let expected = true;


    let expr = ExprWrapper::new(expression)
        // .config(Default::default())
        .config(EvalConfig { // same as Default::default() ^
            include_maths: true,
            include_regex: true,
            include_datetime: true,
            include_cast: true,
        })
        .init();

    match expr.exec() {
        Ok(value) => {
            assert_eq!(value, expected);
        }
        Err(err) => {
            panic!("err={err:?}");
        }
    };
    // ...
}

About

Wrapper function of the resolver crate. Provides python-like built-in functions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages