quantor
Declarative quantifiers and logical assertions for Rust iterators and collections.
quantor provides lightweight, expressive tools for validation, filtering, and testing โ with zero dependencies.
โจ Features
quantor lets you express logic over data in a way that feels natural and readable:
- ๐ Quantifiers โ Use familiar constructs like
forall,exists,none, andexactly_one. - ๐งน Selection utilities โ Filter with
select_where, extract duplicates, check for uniqueness. - ๐ง Structured logic โ Run
pairwisecomparisons or validate equality across items. - ๐งช Assertions โ Add runtime guarantees with
assert_forall!,assert_exists!, etc.
Example
use ;
let nums = vec!;
// Check if all elements are even
assert!;
// Use the macro version for test-friendly assertions
assert_forall!;
// Extract matching elements
let evens = select_where;
assert_eq!;
๐ฆ Installation
Add this to your Cargo.toml:
quantor = "0.1"
Optional features:
method-apiโ Enable.forall()and other iterator-style methods.debug-toolsโ Add debugging macros likedebug_assert_forall!ordebug_exists!.
๐ Documentation
See docs.rs for full API documentation and examples.