#character #set #performance #high #range

character-set

High performance set.contains(char)

6 releases (3 breaking)

0.4.0 Sep 28, 2022
0.3.0 Sep 28, 2022
0.2.2 Sep 27, 2022
0.1.0 Sep 24, 2022

#691 in Text processing

Download history 15/week @ 2024-07-22 50/week @ 2024-07-29 26/week @ 2024-08-05 16/week @ 2024-08-12 22/week @ 2024-08-19 18/week @ 2024-08-26 20/week @ 2024-09-02 16/week @ 2024-09-09 13/week @ 2024-09-16 35/week @ 2024-09-23 10/week @ 2024-09-30 22/week @ 2024-10-14 15/week @ 2024-10-21 7/week @ 2024-10-28 26/week @ 2024-11-04

70 downloads per month
Used in 15 crates (2 directly)

MPL-2.0 license

545KB
9K SLoC

#[test]
fn test_ascii_range() {
    let mut set = CharacterSet::default();
    set.insert('a'..'z');
    set.insert('A'..'Z');
    set.insert('0'..'9');
    set.optimize();
    assert_eq!(set.count(), 62);
    assert!(set.contains('a'));
    assert!(!set.contains(' '));
}

Dependencies

~0.5–1MB
~27K SLoC