eles

Crates.ioeles
lib.rseles
version1.0.0
sourcesrc
created_at2022-04-24 00:23:34.220864
updated_at2022-04-24 00:23:34.220864
descriptionELES; Extensible Logical Expression Solver
homepage
repositoryhttps://github.com/usagi/eles
max_upload_size
id572876
size24,506
Usagi Ito (usagi)

documentation

https://docs.rs/eles/

README

githubcrates-iodocs-rs
Build Status

ELES; Extensible Logical Expression Solver

If you have an existing parser that outputs a single boolean value and you want to add support for AND, OR, XOR, and parentheses, ELES can be of great help. For example, if you already have a system that interprets string syntax to determine/search data for a single item, and you want to support AND/OR searches for multiple items or complex conditions assembled using parentheses, ELES is the usefull library for you.

Example

// The simplest example
fn main()
{
 let input = "true && (( false ^^ true && !! false )) || false";
 let literal_parser = |literal: &str| Ok(literal.parse::<bool>().unwrap_or_default());
 let r = eles::solve(&input, literal_parser);
 println!("{:?}", r);
}

More examples are here:

And these tests might be usefull that study usage:

LICENSE

Author

Commit count: 1

cargo fmt