使用旧的 Rust 2015
0.1.1 |
|
---|---|
0.1.0 |
|
#61 in #representing
4KB
一个带有操作集合方法接口的简单接口。
示例
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'));