https://github.com/floating-floaties/eval-utility
Wrapper function of the resolver crate. Provides python-like built-in functions.
https://github.com/floating-floaties/eval-utility
rust
Last synced: 8 days ago
JSON representation
Wrapper function of the resolver crate. Provides python-like built-in functions.
- Host: GitHub
- URL: https://github.com/floating-floaties/eval-utility
- Owner: floating-floaties
- License: gpl-3.0
- Created: 2022-07-14T03:40:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-18T03:44:24.000Z (26 days ago)
- Last Synced: 2026-03-18T19:51:04.736Z (25 days ago)
- Topics: rust
- Language: Rust
- Homepage: https://crates.io/crates/eval-utility
- Size: 112 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Eval Utility
* [Eval Utility](#eval-utility)
* [About](#about)
* [Install](#install)
* [Example](#example)
## About
Wrapper function of the [resolver crate](https://crates.io/crates/resolver). Provides python-like built-in functions.
## Install
Add the following line to your Cargo.toml file (under `[dependencies]`):
```toml
eval-utility = "0.2"
```
## Example
See test cases in [`lib.rs`](https://github.com/floating-floaties/eval-utility/blob/main/src/lib.rs#L484) for more examples.
```rust
use eval_utility::eval_wrapper::{EvalConfig, ExprWrapper};
fn main() {
let expression = "float('42.42') == 42.42";
let expected = true;
let mut 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:?}");
}
};
// ...
}
```