#set #negation #operations #full #boolean #btree-set #negatable

negatable-set

Wrapper for sets that allows full boolean operations including negation

1 unstable release

0.1.0 Nov 2, 2020

#1752 in Data structures

22 downloads per month

MIT/Apache

26KB
670 lines

Wrapper for sets like HashSet or BTreeSet that allows full boolean operations including negation

TLDR

use maplit::btreeset;
use negatable_set::NegatableSet;
use std::collections::BTreeSet;

type Test = NegatableSet<BTreeSet<u64>>;

fn main() {
    let a = Test::from(btreeset! { 3,4,5 });
    let b = Test::from(btreeset! { 1,2,3 });
    let c = !&b;
    let d = &a | &c;
    println!("{:?} {:?} {:?} {:?}", a, b, c, d);
}

Dependencies

~110–455KB
~10K SLoC