#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

#685 in Text processing

Download history 31/week @ 2024-07-19 42/week @ 2024-07-26 27/week @ 2024-08-02 22/week @ 2024-08-09 20/week @ 2024-08-16 18/week @ 2024-08-23 17/week @ 2024-08-30 19/week @ 2024-09-06 16/week @ 2024-09-13 30/week @ 2024-09-20 14/week @ 2024-09-27 5/week @ 2024-10-04 19/week @ 2024-10-11 13/week @ 2024-10-18 8/week @ 2024-10-25 22/week @ 2024-11-01

62 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
~28K SLoC