use std::ffi::OsStr; pub fn default_mime_type() -> &'static str { "application/octet-stream" } pub fn get_mime_type(extension: &OsStr) -> &'static str { let ext_str = match extension.to_str() { Some(ext_str) => ext_str, None => { return default_mime_type(); }, }; match ext_str { "gmi" => "text/gemini", "txt" => "text/plain", _ => default_mime_type(), } }