✨ Python-Style Operator Chaining in Rust
This crate introduces familiar and expressive set operations using symbolic operators like |, &, -, and ^, just like in Python’s set behavior. You can elegantly chain operations for unions, intersections, differences, and symmetric differences, combining Rust’s performance with Python-like readability.
📚 Example Comparison
Python:
=
=
=
= | | # {1, 2, 3, 4}
= & & # set()
= ^ ^ # {1, 2, 4}
Rust:
use HashSetExt;
let set1 = from;
let set2 = from;
let set3 = from;
let union_result = &set1 | &set2 | &set3; // HashSetExt({1, 2, 3, 4})
let intersection_result = &set1 & &set2 & &set3; // HashSetExt({})
let sym_diff_result = &set1 ^ &set2 ^ &set3; // HashSetExt({1, 2, 4})