pub fn hash_set<P, V>(parser: P) -> MapParser<P, Collect<HashSet<V>>>
Expand description
Convert the output of parser
from a Vec<V>
or other collection
into a HashSet
.
For example, the parser alpha+
produces a Vec<char>
,
so hash_set(alpha+)
produces a HashSet<char>
:
let p = parser!(hash_set(alpha+));
let set = p.parse("xZjZZd").unwrap();
assert_eq!(set.len(), 4); // x Z j d
assert!(set.contains(&'d'));
assert!(!set.contains(&'r'));