rapidstr2int 1.0.21

Fast dependency-free string to 32-bit integer hashing (FNV-1a)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use rapidstr2int::str_to_int;
use std::fs;

// Exercise the algorithm over every binary corpus file under tests/.
#[test]
fn corpus() {
    if let Ok(rd) = fs::read_dir("tests") {
        for entry in rd.flatten() {
            let p = entry.path();
            if p.extension().map(|e| e == "bin").unwrap_or(false) {
                let data = fs::read(&p).expect("read corpus file");
                let s = String::from_utf8_lossy(&data);
                let _ = str_to_int(&s);
            }
        }
    }
}