evaluator_rs
A evaluation engine library for Rust.
Usage
Please see the Documentation for more details.
Add to your Cargo.toml:
[]
= "0.1"
Examples:
extern crate evaluator_rs;
use HashMap;
use ;
Data types
| Type | Examples |
|---|---|
| Number | 1 |
| String | 'hello world' |
| Bool | true |
| Array | [1, 2, 3] |
Supported operators
| Operator | Precedence | Description |
|---|---|---|
| && | 1 | And |
| || | 1 | Or |
| == | 2 | Equal |
| > | 2 | Greater than |
| >= | 2 | Greater than or equal |
| < | 2 | Lower than |
| <= | 2 | Lower than or equal |
| in | 2 | Array contains |
| * | 3 | Product |
| / | 3 | Division |
| + | 4 | Sum |
| - | 4 | Sub |
Identifier
Identifiers are wrapped by curly brace. When expression is evaluated, parameters must be provided identifier value.
Examples:
let expr = parse_expr.unwrap;
let parameters = from;
let rs = evaluate.unwrap;
assert_eq!;
License
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)