🧮 Boolean expression evaluation engine. A Rust port of boolrule.

Overview

coolrule

Rust crates.io v1.0.0

My blog post: Porting Boolrule to Rust


Boolean expression evaluation engine (a port of boolrule to Rust).

// Without context
let expr = coolrule::new("1 in (1, 2, 3) or 2 > 3")?;
let test = expr.test()?; // true

// With context
let expr = coolrule::new("x ∉ (5, 6, 7)")?;
let test = expr.test_with_context(
    HashMap::from([(vec!["x"], Value::Number(8.0))])
)?; // true

The boolrule test suite has also been ported (and passes) see lib.rs.

Expressions are parsed via PEG parser combinators (powered by pom).

It's around 3x faster than the Python version (before any kind of optimization work).

I'm still learning how to write idiomatic Rust so if you see anything strange please let me know!

Tests

cargo test

You might also like...
A Rust port of the command line program playing with the cutscenes files (USM) from Genshin Impact.

GI-cutscenes : Rust Remix A command line program playing with the cutscene files (USM) from Genshin Impact, reimplemented in Rust. Much like its origi

Rust port of https://github.com/hunar4321/life_code with some fun features.
Rust port of https://github.com/hunar4321/life_code with some fun features.

Smarticles A Rust port of Brainxyz's Artificial Life simulator with some fun features. A simple program to simulate primitive Artificial Life using si

png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance.

png_defringe_rs png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance. U

`ggllama` is a Rust port of ggerganov's llama.cpp.

Notice llama-rs beat me to the punch. I'll be contributing to that instead. The original README is preserved below. ggllama ggllama is a Rust port of

A port of everything to Rust 🦀
A port of everything to Rust 🦀

everything.rs Do you ever feel like washing your hands after a coding session, disgusted at having to use essential Unix utilities with not the tinies

Truly universal encoding detector in pure Rust - port of Python version

Charset Normalizer A library that helps you read text from an unknown charset encoding. Motivated by original Python version of charset-normalizer, I'

port sniffer, multithreading

SniffSniff I am trying to learn Rust programming language. Here is a small project that sniffs the ports of a given host. I want to give some info wha

A command-line tool to easily kill processes running on a specified port.

killport killport is a command-line utility for killing processes listening on specific ports. It's designed to be simple, fast, and effective. The to

A simple demo to bind a TCP port with k8s exec channel.k8s.io websocket API.

k8s-webterm-connector Tired with web terminals? Let's use it with CLI! This is just a simple demo to bind a TCP port with k8s exec websocket API, whic

Owner
Andrew Healey
software engineer @vercel
Andrew Healey
Choose Rust types at compile-time via boolean constants

condtype Choose Rust types at compile-time via boolean constants, brought to you by Nikolai Vazquez. If you find this library useful, consider starrin

Nikolai Vazquez 36 May 8, 2023
Rust regex in ECMAScript regular expression syntax!

ecma_regex The goal of ecma_regex is to provide the same functionality as the regex crate in ECMAScript regular expression syntax. Reliable regex engi

HeYunfei 6 Mar 7, 2023
The Ergex Regular Expression Library

The Ergex Regular Expression Library Introduction Ergex is a regular expression library that does a few things rather differently from many other libr

Rob King 119 Dec 6, 2022
A new, portable, regular expression language

rulex A new, portable, regular expression language Read the book to get started! Examples On the left are rulex expressions (rulexes for short), on th

Ludwig Stecher 912 Dec 29, 2022
A new, portable, regular expression language

rulex A new, portable, regular expression language Read the book to get started! Examples On the left are rulex expressions (rulexes for short), on th

rulex 144 May 17, 2022
Experimental engine agnostic 3D CSG library for game development written in Rust. Started as a port of csg.js to Rust.

brusher Experimental engine agnostic 3D CSG library for game development written in Rust. Started as a port of csg.js to Rust. ultimate goal My hope i

Brian Howard 17 Sep 4, 2024
Rust port of pexpect

rexpect Spawn, control, and respond to expected patterns of child applications and processes, enabling the automation of interactions and testing. Com

Philipp Keller 177 Dec 25, 2022
Dog command for *nix systems, Rust port of dog.

dog-rs Dog command for *nix systems, Rust port of dog. Because there is a cat command, should be a dog command too. It was written completely using VS

Juanjo Salvador 2 Sep 29, 2021
Rust port of InfectedRose.Interface

Rust port of Wincent's InfectedRose.Interface. It is not finished; only adding to the database is possible at the moment, editing and removing is not,

zaop 3 Feb 2, 2022
This is a command line port of the game Wordle in Rust

Wordle.rs Welcome to Wordle.rs! This is a command line port of the game Wordle in Rust. I built this in order to get more familiar with programming in

Brock Herion 5 Apr 8, 2022