logical-expressions

Crates.iological-expressions
lib.rslogical-expressions
version0.1.3
created_at2025-02-22 19:02:27.704512+00
updated_at2025-03-17 17:13:42.475262+00
descriptionA library for working with logical expressions
homepage
repositoryhttps://gitlab.com/porky11/logical-expressions
max_upload_size
id1565666
size26,323
Fabio Krapohl (porky11)

documentation

README

Logical Expressions

A library for working with logical expressions in Rust.

Features

  • Representing logical expressions using the LogicalExpression enum (supports And lists, Or lists and single conditions)
  • Support for custom types to represent conditions
  • Parsing logical expressions from strings with proper error handling
  • Expanding logical expressions into a list of lists, where the inner lists represent AND conditions and the outer lists represent OR conditions (DNF)

Quickstart

Here's an example of how to use the library:

use logical_expressions::LogicalExpression;

let expression: LogicalExpression<String> = LogicalExpression::parse("a & (b | c)").unwrap();
let expanded = expression.expand();
println!("{expanded:?}");

This will output:

[["a", "b"], ["a", "c"]]

Documentation

For more detailed information and examples, please refer to the API documentation.

Commit count: 12

cargo fmt