diff --git a/melib/src/email/attachment_types.rs b/melib/src/email/attachment_types.rs index 0d3c80f8..6bb963e1 100644 --- a/melib/src/email/attachment_types.rs +++ b/melib/src/email/attachment_types.rs @@ -222,8 +222,9 @@ impl std::fmt::Display for MultipartType { } } -impl From<&[u8]> for MultipartType { - fn from(val: &[u8]) -> Self { +impl> From for MultipartType { + fn from(val: B) -> Self { + let val = val.as_ref(); if val.eq_ignore_ascii_case(b"mixed") { Self::Mixed } else if val.eq_ignore_ascii_case(b"alternative") { @@ -488,8 +489,9 @@ impl std::fmt::Display for ContentTransferEncoding { } } } -impl From<&[u8]> for ContentTransferEncoding { - fn from(val: &[u8]) -> Self { +impl> From for ContentTransferEncoding { + fn from(val: B) -> Self { + let val = val.as_ref(); if val.eq_ignore_ascii_case(b"base64") { Self::Base64 } else if val.eq_ignore_ascii_case(b"7bit") { @@ -542,8 +544,9 @@ impl std::fmt::Display for ContentDispositionKind { } } } -impl From<&[u8]> for ContentDisposition { - fn from(val: &[u8]) -> Self { +impl> From for ContentDisposition { + fn from(val: B) -> Self { + let val = val.as_ref(); crate::email::parser::attachments::content_disposition(val) .map(|(_, v)| v) .unwrap_or_default() diff --git a/melib/src/thread.rs b/melib/src/thread.rs index 71be9e08..00af2cc7 100644 --- a/melib/src/thread.rs +++ b/melib/src/thread.rs @@ -74,8 +74,9 @@ macro_rules! uuid_hash_type { } } - impl From<&[u8]> for $n { - fn from(val: &[u8]) -> Self { + impl> From for $n { + fn from(val: B) -> Self { + let val = val.as_ref(); $n(Uuid::new_v5(&Uuid::NAMESPACE_URL, val)) } }