Crate set [] [src]

A simple interface with methods for manipulating sets.

Examples

use set;
use set::Set;

// A set that contains ASCII
let ascii = set::predicate(|c| c as u32 <= 0x7F);
assert!(ascii.contains('a'));
assert!(!ascii.contains('❤'));

let s = set::predicate(|c: char| c.is_uppercase());
assert!(s.contains('B'));

// A char is a quine atom. That is, it is a set that contains only itself.
assert!('t'.contains('t'));

// Functions and closures that match the signature of contains are themselves sets.
assert!(char::is_lowercase.contains('b'));

Structs

PredicateSet

Implements Set using a predicate callable. Normally created via the predicate function.

Traits

Set

A simple trait representing a set.

Functions

predicate

Returns a set with a contains method that calls f(c).