← go back
reject HashMap
, embrace match
// This should be generated by charset_index.py
fn charset_index(x: &char) -> Sample {
match x {
'0' => 0.0,
'1' => 0.0002366863905325444,
'2' => 0.0009467455621301776,
'3' => 0.0021301775147928997,
'4' => 0.0037869822485207105,
'5' => 0.00591715976331361,
'6' => 0.008520710059171599,
'7' => 0.011597633136094675,
'8' => 0.015147928994082842,
'9' => 0.019171597633136098,
'A' => 0.02366863905325444,
'B' => 0.028639053254437875,
'C' => 0.034082840236686396,
'D' => 0.04000000000000001,
'E' => 0.0463905325443787,
'F' => 0.053254437869822494,
'G' => 0.06059171597633137,
'H' => 0.06840236686390533,
'I' => 0.07668639053254439,
'J' => 0.08544378698224853,
'K' => 0.09467455621301776,
'L' => 0.10437869822485209,
'M' => 0.1145562130177515,
'N' => 0.125207100591716,
'O' => 0.13633136094674558,
'P' => 0.14792899408284024,
'Q' => 0.16000000000000003,
'R' => 0.17254437869822487,
'S' => 0.1855621301775148,
'T' => 0.19905325443786984,
'U' => 0.21301775147928997,
'V' => 0.22745562130177518,
'W' => 0.24236686390532547,
'X' => 0.2577514792899408,
'Y' => 0.2736094674556213,
'Z' => 0.28994082840236685,
'`' => 0.30674556213017756,
'-' => 0.32402366863905324,
'=' => 0.3417751479289941,
'[' => 0.36,
']' => 0.37869822485207105,
';' => 0.3978698224852071,
'\'' => 0.41751479289940835,
',' => 0.4376331360946745,
'.' => 0.458224852071006,
'/' => 0.4792899408284023,
'~' => 0.500828402366864,
'!' => 0.5228402366863905,
'@' => 0.5453254437869823,
'#' => 0.5682840236686391,
'$' => 0.591715976331361,
'%' => 0.615621301775148,
'^' => 0.6400000000000001,
'&' => 0.6648520710059171,
'*' => 0.6901775147928995,
'(' => 0.7159763313609467,
')' => 0.7422485207100592,
'_' => 0.7689940828402366,
'+' => 0.7962130177514793,
'{' => 0.8239053254437869,
'}' => 0.8520710059171599,
'|' => 0.8807100591715976,
':' => 0.9098224852071007,
'<' => 0.9394082840236686,
'>' => 0.9694674556213019,
'?' => 1.0,
_ => panic!("{}", format!("FIXME: char {:#?} not indexed:", x)),
}
}
May 19, 2023, 2:16 PM
0 0 0
Comments