diff --git a/src/well_known_mime.rs b/src/well_known_mime.rs index e3c5f0c..c9c292c 100644 --- a/src/well_known_mime.rs +++ b/src/well_known_mime.rs @@ -6,7 +6,7 @@ use lazy_static::lazy_static; #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash)] pub enum Mime { /// Well-known mime - WellKnown(usize), + WellKnown(u16), /// Custom mime Custom(String), } @@ -35,7 +35,7 @@ impl Display for Mime { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { Mime::WellKnown(n) => { - if let Some(s) = WELL_KNOWN.get(*n) { + if let Some(s) = WELL_KNOWN.get(*n as usize) { f.write_str(s) } else { f.write_str("application/octet-stream") @@ -749,10 +749,10 @@ const WELL_KNOWN : &[&str] = &[ use std::collections::HashMap; lazy_static!{ - static ref MIME_LOOKUP : HashMap<&'static str, usize> = { + static ref MIME_LOOKUP : HashMap<&'static str, u16> = { let mut map = HashMap::new(); for (n, entry) in WELL_KNOWN.iter().enumerate() { - map.insert(*entry, n); + map.insert(*entry, n as u16); } map };