diff --git a/Cargo.toml b/Cargo.toml index 1dd5a3a..3fc4492 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" resolver = "2" [dependencies] -hashify = { version = "0.2" } +hashify = { version = "0.3" } memchr = { version = "2.7", optional = true } encoding_rs = { version = "0.8", optional = true } serde = { version = "1.0", features = ["derive"], optional = true } diff --git a/src/decoders/charsets/map.rs b/src/decoders/charsets/map.rs index f33ab09..96be4a2 100644 --- a/src/decoders/charsets/map.rs +++ b/src/decoders/charsets/map.rs @@ -22,7 +22,7 @@ pub fn charset_decoder(charset: &[u8]) -> Option { }; } - hashify::tiny_map!(&l_charset[..charset.len().clamp(1, 45)], + hashify::map!(&l_charset[..charset.len().clamp(1, 45)], DecoderFnc, "850" => decoder_ibm_850, "866" => decoder_ibm866, "ansi_x3.4_1968" => decoder_cp1252, @@ -276,6 +276,7 @@ pub fn charset_decoder(charset: &[u8]) -> Option { "x_user_defined" => decoder_x_user_defined, "x_x_big5" => decoder_big5, ) + .copied() } #[cfg(test)] diff --git a/src/lib.rs b/src/lib.rs index 6314fa7..420389c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -256,8 +256,9 @@ macro_rules! header_names { } pub(crate) fn header_map(name: &[u8]) -> Option> { - hashify::tiny_map!(name, - $($lc => HeaderName::$variant,)+ + hashify::fnc_map!(name, + $($lc => Some(HeaderName::$variant),)+ + _ => None ) } diff --git a/src/parsers/fields/date.rs b/src/parsers/fields/date.rs index c671721..72b67b1 100644 --- a/src/parsers/fields/date.rs +++ b/src/parsers/fields/date.rs @@ -452,7 +452,7 @@ impl<'x> MessageStream<'x> { } } - hashify::tiny_map! { buf.as_ref(), + hashify::map! { buf.as_ref(), i32, "EDT" => -4, "EST" => -5, "CDT" => -5, @@ -462,6 +462,7 @@ impl<'x> MessageStream<'x> { "PDT" => -7, "PST" => -8, } + .copied() .unwrap_or(0) } } diff --git a/src/parsers/fields/thread.rs b/src/parsers/fields/thread.rs index 799d5c9..9a57a96 100644 --- a/src/parsers/fields/thread.rs +++ b/src/parsers/fields/thread.rs @@ -8,7 +8,7 @@ const MAX_PREFIX_LEN: usize = 40; const MAX_GENERIC_PREFIX_CHARS: usize = 4; fn is_re_prefix(prefix: &str) -> bool { - hashify::tiny_set! {prefix.as_bytes(), + hashify::set! {prefix.as_bytes(), "re", "res", "resp", @@ -85,7 +85,7 @@ fn is_re_prefix(prefix: &str) -> bool { } fn is_fwd_prefix(prefix: &str) -> bool { - hashify::tiny_set! {prefix.as_bytes(), + hashify::set! {prefix.as_bytes(), "fwd", "fw", "rv",