START.call_once(|| { let mut map = HashMap::new(); map.insert(".3dm","x-world/x-3dmf"); map.insert(".3dmf","x-world/x-3dmf"); map.insert(".a","application/octet-stream"); map.insert(".aab","application/x-authorware-bin"); map.insert(".aam","application/x-authorware-map"); map.insert(".aas","application/x-authorware-seg"); map.insert(".abc","text/vnd.abc"); map.insert(".acgi","text/html"); map.insert(".afl","video/animaflex"); map.insert(".ai","application/postscript"); map.insert(".aif","audio/aiff"); map.insert(".aifc","audio/aiff"); map.insert(".aiff","audio/aiff"); map.insert(".aim","application/x-aim"); map.insert(".aip","text/x-audiosoft-intra"); map.insert(".ani","application/x-navi-animation"); map.insert(".aos","application/x-nokia-9000-communicator-add-on-software"); map.insert(".aps","application/mime"); map.insert(".arc","application/octet-stream"); map.insert(".arj","application/arj"); map.insert(".art","image/x-jg"); map.insert(".asf","video/x-ms-asf"); map.insert(".asm","text/x-asm"); map.insert(".asp","text/asp"); map.insert(".asx","application/x-mplayer2"); map.insert(".au","audio/basic"); map.insert(".avi","video/x-msvideo"); map.insert(".avs","video/avs-video"); map.insert(".bcpio","application/x-bcpio"); map.insert(".bin","application/mac-binary"); map.insert(".bm","image/bmp"); map.insert(".bmp","image/bmp"); map.insert(".boo","application/book"); map.insert(".book","application/book"); map.insert(".boz","application/x-bzip2"); map.insert(".bsh","application/x-bsh"); map.insert(".bz","application/x-bzip"); map.insert(".bz2","application/x-bzip2"); map.insert(".c","text/plain"); map.insert(".c++","text/plain"); map.insert(".cat","application/vnd.ms-pki.seccat"); map.insert(".cc","text/plain"); map.insert(".ccad","application/clariscad"); map.insert(".cco","application/x-cocoa"); map.insert(".cdf","application/cdf"); map.insert(".cer","application/pkix-cert"); map.insert(".cha","application/x-chat"); map.insert(".chat","application/x-chat"); map.insert(".class","application/java"); map.insert(".com","application/octet-stream"); map.insert(".conf","text/plain"); map.insert(".cpio","application/x-cpio"); map.insert(".cpp","text/x-c"); map.insert(".cpt","application/mac-compactpro"); map.insert(".crl","application/pkcs-crl"); map.insert(".crt","application/pkix-cert"); map.insert(".csh","application/x-csh"); map.insert(".css","text/css"); map.insert(".cxx","text/plain"); map.insert(".dcr","application/x-director"); map.insert(".deepv","application/x-deepv"); map.insert(".def","text/plain"); map.insert(".der","application/x-x509-ca-cert"); map.insert(".dif","video/x-dv"); map.insert(".dir","application/x-director"); map.insert(".dl","video/dl"); map.insert(".doc","application/msword"); map.insert(".dot","application/msword"); map.insert(".dp","application/commonground"); map.insert(".drw","application/drafting"); map.insert(".dump","application/octet-stream"); map.insert(".dv","video/x-dv"); map.insert(".dvi","application/x-dvi"); map.insert(".dwf","drawing/x-dwf (old)"); map.insert(".dwg","application/acad"); map.insert(".dxf","application/dxf"); map.insert(".dxr","application/x-director"); map.insert(".el","text/x-script.elisp"); map.insert(".elc","application/x-bytecode.elisp (compiled elisp)"); map.insert(".env","application/x-envoy"); map.insert(".eps","application/postscript"); map.insert(".es","application/x-esrehber"); map.insert(".etx","text/x-setext"); map.insert(".evy","application/envoy"); map.insert(".exe","application/octet-stream"); map.insert(".f","text/plain"); map.insert(".f77","text/x-fortran"); map.insert(".f90","text/plain"); map.insert(".fdf","application/vnd.fdf"); map.insert(".fif","application/fractals"); map.insert(".fli","video/fli"); map.insert(".flo","image/florian"); map.insert(".flx","text/vnd.fmi.flexstor"); map.insert(".fmf","video/x-atomic3d-feature"); map.insert(".for","text/plain"); map.insert(".fpx","image/vnd.fpx"); map.insert(".frl","application/freeloader"); map.insert(".funk","audio/make"); map.insert(".g","text/plain"); map.insert(".g3","image/g3fax"); map.insert(".gif","image/gif"); map.insert(".gl","video/gl"); map.insert(".gsd","audio/x-gsm"); map.insert(".gsm","audio/x-gsm"); map.insert(".gsp","application/x-gsp"); map.insert(".gss","application/x-gss"); map.insert(".gtar","application/x-gtar"); map.insert(".gz","application/x-compressed"); map.insert(".gzip","application/x-gzip"); map.insert(".h","text/plain"); map.insert(".hdf","application/x-hdf"); map.insert(".help","application/x-helpfile"); map.insert(".hgl","application/vnd.hp-hpgl"); map.insert(".hh","text/plain"); map.insert(".hlb","text/x-script"); map.insert(".hlp","application/hlp"); map.insert(".hpg","application/vnd.hp-hpgl"); map.insert(".hpgl","application/vnd.hp-hpgl"); map.insert(".hqx","application/binhex"); map.insert(".hta","application/hta"); map.insert(".htc","text/x-component"); map.insert(".htm","text/html"); map.insert(".html","text/html"); map.insert(".htmls","text/html"); map.insert(".htt","text/webviewhtml"); map.insert(".htx","text/html"); map.insert(".ice","x-conference/x-cooltalk"); map.insert(".ico","image/x-icon"); map.insert(".idc","text/plain"); map.insert(".ief","image/ief"); map.insert(".iefs","image/ief"); map.insert(".iges","application/iges"); map.insert(".igs","application/iges"); map.insert(".ima","application/x-ima"); map.insert(".imap","application/x-httpd-imap"); map.insert(".inf","application/inf"); map.insert(".ins","application/x-internett-signup"); map.insert(".ip","application/x-ip2"); map.insert(".isu","video/x-isvideo"); map.insert(".it","audio/it"); map.insert(".iv","application/x-inventor"); map.insert(".ivr","i-world/i-vrml"); map.insert(".ivy","application/x-livescreen"); map.insert(".jam","audio/x-jam"); map.insert(".jav","text/plain"); map.insert(".jar","application/java-archive"); map.insert(".java","text/plain"); map.insert(".jcm","application/x-java-commerce"); map.insert(".jfif","image/jpeg"); map.insert(".jfif-tbnl","image/jpeg"); map.insert(".jnlp","application/x-java-jnlp-file"); map.insert(".jpe","image/jpeg"); map.insert(".jpeg","image/jpeg"); map.insert(".jpg","image/jpeg"); map.insert(".jps","image/x-jps"); map.insert(".js","application/x-javascript"); map.insert(".json","application/json"); map.insert(".jut","image/jutvision"); map.insert(".kar","audio/midi"); map.insert(".ksh","application/x-ksh"); map.insert(".la","audio/nspaudio"); map.insert(".lam","audio/x-liveaudio"); map.insert(".latex","application/x-latex"); map.insert(".lha","application/lha"); map.insert(".lhx","application/octet-stream"); map.insert(".list","text/plain"); map.insert(".lma","audio/nspaudio"); map.insert(".log","text/plain"); map.insert(".lsp","application/x-lisp"); map.insert(".lst","text/plain"); map.insert(".lsx","text/x-la-asf"); map.insert(".ltx","application/x-latex"); map.insert(".lzh","application/octet-stream"); map.insert(".lzx","application/lzx"); map.insert(".m","text/plain"); map.insert(".m1v","video/mpeg"); map.insert(".m2a","audio/mpeg"); map.insert(".m2v","video/mpeg"); map.insert(".m3u","audio/x-mpequrl"); map.insert(".man","application/x-troff-man"); map.insert(".map","application/x-navimap"); map.insert(".mar","text/plain"); map.insert(".mbd","application/mbedlet"); map.insert(".mc$","application/x-magic-cap-package-1.0"); map.insert(".mcd","application/mcad"); map.insert(".mcf","image/vasa"); map.insert(".mcp","application/netmc"); map.insert(".me","application/x-troff-me"); map.insert(".mht","message/rfc822"); map.insert(".mhtml","message/rfc822"); map.insert(".mid","application/x-midi"); map.insert(".midi","application/x-midi"); map.insert(".mif","application/x-frame"); map.insert(".mime","message/rfc822"); map.insert(".mjf","audio/x-vnd.audioexplosion.mjuicemediafile"); map.insert(".mjpg","video/x-motion-jpeg"); map.insert(".mm","application/base64"); map.insert(".mme","application/base64"); map.insert(".mod","audio/mod"); map.insert(".moov","video/quicktime"); map.insert(".mov","video/quicktime"); map.insert(".movie","video/x-sgi-movie"); map.insert(".mp2","audio/mpeg"); map.insert(".mp3","audio/mp3"); map.insert(".m4a","audio/m4a"); map.insert(".mp4","video/mp4"); map.insert(".mpa","audio/mpeg"); map.insert(".mpc","application/x-project"); map.insert(".mpe","video/mpeg"); map.insert(".mpeg","video/mpeg"); map.insert(".mpg","audio/mpeg"); map.insert(".mpga","audio/mpeg"); map.insert(".mpp","application/vnd.ms-project"); map.insert(".mpt","application/x-project"); map.insert(".mpv","application/x-project"); map.insert(".mpx","application/x-project"); map.insert(".mrc","application/marc"); map.insert(".ms","application/x-troff-ms"); map.insert(".mv","video/x-sgi-movie"); map.insert(".my","audio/make"); map.insert(".mzz","application/x-vnd.audioexplosion.mzz"); map.insert(".nap","image/naplps"); map.insert(".naplps","image/naplps"); map.insert(".nc","application/x-netcdf"); map.insert(".ncm","application/vnd.nokia.configuration-message"); map.insert(".nif","image/x-niff"); map.insert(".niff","image/x-niff"); map.insert(".nix","application/x-mix-transfer"); map.insert(".nsc","application/x-conference"); map.insert(".nvd","application/x-navidoc"); map.insert(".o","application/octet-stream"); map.insert(".oda","application/oda"); map.insert(".omc","application/x-omc"); map.insert(".omcd","application/x-omcdatamaker"); map.insert(".omcr","application/x-omcregerator"); map.insert(".p","text/x-pascal"); map.insert(".p10","application/pkcs10"); map.insert(".p12","application/pkcs-12"); map.insert(".p7a","application/x-pkcs7-signature"); map.insert(".p7c","application/pkcs7-mime"); map.insert(".p7m","application/pkcs7-mime"); map.insert(".p7r","application/x-pkcs7-certreqresp"); map.insert(".p7s","application/pkcs7-signature"); map.insert(".part","application/pro_eng"); map.insert(".pas","text/pascal"); map.insert(".pbm","image/x-portable-bitmap"); map.insert(".pcl","application/vnd.hp-pcl"); map.insert(".pct","image/x-pict"); map.insert(".pcx","image/x-pcx"); map.insert(".pdb","chemical/x-pdb"); map.insert(".pdf","application/pdf"); map.insert(".pfunk","audio/make"); map.insert(".pgm","image/x-portable-graymap"); map.insert(".pic","image/pict"); map.insert(".pict","image/pict"); map.insert(".pkg","application/x-newton-compatible-pkg"); map.insert(".pko","application/vnd.ms-pki.pko"); map.insert(".pl","text/plain"); map.insert(".plx","application/x-pixclscript"); map.insert(".pm","image/x-xpixmap"); map.insert(".pm4","application/x-pagemaker"); map.insert(".pm5","application/x-pagemaker"); map.insert(".png","image/png"); map.insert(".pnm","application/x-portable-anymap"); map.insert(".pot","application/mspowerpoint"); map.insert(".pov","model/x-pov"); map.insert(".ppa","application/vnd.ms-powerpoint"); map.insert(".ppm","image/x-portable-pixmap"); map.insert(".pps","application/mspowerpoint"); map.insert(".ppt","application/mspowerpoint"); map.insert(".ppz","application/mspowerpoint"); map.insert(".pre","application/x-freelance"); map.insert(".prt","application/pro_eng"); map.insert(".ps","application/postscript"); map.insert(".psd","application/octet-stream"); map.insert(".pvu","paleovu/x-pv"); map.insert(".pwz","application/vnd.ms-powerpoint"); map.insert(".py","text/x-script.phyton"); map.insert(".pyc","applicaiton/x-bytecode.python"); map.insert(".qcp","audio/vnd.qcelp"); map.insert(".qd3","x-world/x-3dmf"); map.insert(".qd3d","x-world/x-3dmf"); map.insert(".qif","image/x-quicktime"); map.insert(".qt","video/quicktime"); map.insert(".qtc","video/x-qtc"); map.insert(".qti","image/x-quicktime"); map.insert(".qtif","image/x-quicktime"); map.insert(".ra","audio/x-pn-realaudio"); map.insert(".ram","audio/x-pn-realaudio"); map.insert(".ras","application/x-cmu-raster"); map.insert(".rast","image/cmu-raster"); map.insert(".rexx","text/x-script.rexx"); map.insert(".rf","image/vnd.rn-realflash"); map.insert(".rgb","image/x-rgb"); map.insert(".rm","application/vnd.rn-realmedia"); map.insert(".rmi","audio/mid"); map.insert(".rmm","audio/x-pn-realaudio"); map.insert(".rmp","audio/x-pn-realaudio"); map.insert(".rng","application/ringing-tones"); map.insert(".rnx","application/vnd.rn-realplayer"); map.insert(".roff","application/x-troff"); map.insert(".rp","image/vnd.rn-realpix"); map.insert(".rpm","audio/x-pn-realaudio-plugin"); map.insert(".rt","text/richtext"); map.insert(".rtf","application/rtf"); map.insert(".rtx","application/rtf"); map.insert(".rv","video/vnd.rn-realvideo"); map.insert(".s","text/x-asm"); map.insert(".s3m","audio/s3m"); map.insert(".saveme","application/octet-stream"); map.insert(".sbk","application/x-tbook"); map.insert(".scm","application/x-lotusscreencam"); map.insert(".sdml","text/plain"); map.insert(".sdp","application/sdp"); map.insert(".sdr","application/sounder"); map.insert(".sea","application/sea"); map.insert(".set","application/set"); map.insert(".sgm","text/sgml"); map.insert(".sgml","text/sgml"); map.insert(".sh","application/x-bsh"); map.insert(".shar","application/x-bsh"); map.insert(".shtml","text/html"); map.insert(".sid","audio/x-psid"); map.insert(".sit","application/x-sit"); map.insert(".skd","application/x-koan"); map.insert(".skm","application/x-koan"); map.insert(".skp","application/x-koan"); map.insert(".skt","application/x-koan"); map.insert(".sl","application/x-seelogo"); map.insert(".smi","application/smil"); map.insert(".smil","application/smil"); map.insert(".snd","audio/basic"); map.insert(".sol","application/solids"); map.insert(".spc","application/x-pkcs7-certificates"); map.insert(".spl","application/futuresplash"); map.insert(".spr","application/x-sprite"); map.insert(".sprite","application/x-sprite"); map.insert(".src","application/x-wais-source"); map.insert(".ssi","text/x-server-parsed-html"); map.insert(".ssm","application/streamingmedia"); map.insert(".sst","application/vnd.ms-pki.certstore"); map.insert(".step","application/step"); map.insert(".stl","application/sla"); map.insert(".stp","application/step"); map.insert(".sv4cpio","application/x-sv4cpio"); map.insert(".sv4crc","application/x-sv4crc"); map.insert(".svf","image/vnd.dwg"); map.insert(".svg","image/svg+xml"); map.insert(".svr","application/x-world"); map.insert(".swf","application/x-shockwave-flash"); map.insert(".t","application/x-troff"); map.insert(".talk","text/x-speech"); map.insert(".tar","application/x-tar"); map.insert(".tbk","application/toolbook"); map.insert(".tcl","application/x-tcl"); map.insert(".tcsh","text/x-script.tcsh"); map.insert(".tex","application/x-tex"); map.insert(".texi","application/x-texinfo"); map.insert(".texinfo","application/x-texinfo"); map.insert(".text","application/plain"); map.insert(".tgz","application/gnutar"); map.insert(".tif","image/tiff"); map.insert(".tiff","image/tiff"); map.insert(".tr","application/x-troff"); map.insert(".tsi","audio/tsp-audio"); map.insert(".tsp","application/dsptype"); map.insert(".tsv","text/tab-separated-values"); map.insert(".turbot","image/florian"); map.insert(".txt","text/plain"); map.insert(".uil","text/x-uil"); map.insert(".uni","text/uri-list"); map.insert(".unis","text/uri-list"); map.insert(".unv","application/i-deas"); map.insert(".uri","text/uri-list"); map.insert(".uris","text/uri-list"); map.insert(".ustar","application/x-ustar"); map.insert(".uu","application/octet-stream"); map.insert(".uue","text/x-uuencode"); map.insert(".vcd","application/x-cdlink"); map.insert(".vcs","text/x-vcalendar"); map.insert(".vda","application/vda"); map.insert(".vdo","video/vdo"); map.insert(".vew","application/groupwise"); map.insert(".viv","video/vivo"); map.insert(".vivo","video/vivo"); map.insert(".vmd","application/vocaltec-media-desc"); map.insert(".vmf","application/vocaltec-media-file"); map.insert(".voc","audio/voc"); map.insert(".vos","video/vosaic"); map.insert(".vox","audio/voxware"); map.insert(".vqe","audio/x-twinvq-plugin"); map.insert(".vqf","audio/x-twinvq"); map.insert(".vql","audio/x-twinvq-plugin"); map.insert(".vrml","application/x-vrml"); map.insert(".vrt","x-world/x-vrt"); map.insert(".vsd","application/x-visio"); map.insert(".vst","application/x-visio"); map.insert(".vsw","application/x-visio"); map.insert(".w60","application/wordperfect6.0"); map.insert(".w61","application/wordperfect6.1"); map.insert(".w6w","application/msword"); map.insert(".wav","audio/wav"); map.insert(".wb1","application/x-qpro"); map.insert(".wbmp","image/vnd.wap.wbmp"); map.insert(".web","application/vnd.xara"); map.insert(".wiz","application/msword"); map.insert(".wk1","application/x-123"); map.insert(".wmf","windows/metafile"); map.insert(".wml","text/vnd.wap.wml"); map.insert(".wmlc","application/vnd.wap.wmlc"); map.insert(".wmls","text/vnd.wap.wmlscript"); map.insert(".wmlsc","application/vnd.wap.wmlscriptc"); map.insert(".word","application/msword"); map.insert(".wp","application/wordperfect"); map.insert(".wp5","application/wordperfect"); map.insert(".wp6","application/wordperfect"); map.insert(".wpd","application/wordperfect"); map.insert(".wq1","application/x-lotus"); map.insert(".wri","application/mswrite"); map.insert(".wrl","application/x-world"); map.insert(".wrz","model/vrml"); map.insert(".wsc","text/scriplet"); map.insert(".wsrc","application/x-wais-source"); map.insert(".wtk","application/x-wintalk"); map.insert(".x-png","image/png"); map.insert(".xbm","image/x-xbitmap"); map.insert(".xdr","video/x-amt-demorun"); map.insert(".xgz","xgl/drawing"); map.insert(".xif","image/vnd.xiff"); map.insert(".xl","application/excel"); map.insert(".xla","application/excel"); map.insert(".xlb","application/excel"); map.insert(".xlc","application/excel"); map.insert(".xld","application/excel"); map.insert(".xlk","application/excel"); map.insert(".xll","application/excel"); map.insert(".xlm","application/excel"); map.insert(".xls","application/excel"); map.insert(".xlt","application/excel"); map.insert(".xlv","application/excel"); map.insert(".xlw","application/excel"); map.insert(".xm","audio/xm"); map.insert(".xml","application/xml"); map.insert(".xmz","xgl/movie"); map.insert(".xpix","application/x-vnd.ls-xpix"); map.insert(".xpm","image/x-xpixmap"); map.insert(".xsr","video/x-amt-showrun"); map.insert(".xwd","image/x-xwd"); map.insert(".xyz","chemical/x-pdb"); map.insert(".z","application/x-compress"); map.insert(".zip","application/x-compressed"); map.insert(".zoo","application/octet-stream"); map.insert(".zsh","text/x-script.zsh"); map.insert(".wsdl","application/xml"); map.insert(".flv","video/x-flv"); map.insert(".wmv","video/x-ms-wmv"); map.insert(".264","video/mp4"); map.insert(".vdi","application/x-virtualbox-vdi"); //MIMETYPES.set(RwLock::new(map)); *MIMETYPES.write().unwrap() = Some(map); xxx(); }); let mut a = path.to_owned(); let i = a.rfind('.'); if i.is_some() { let i = i.unwrap(); a = a[i..].to_string(); } let map = &mut MIMETYPES.write().unwrap(); let map = map.as_ref().unwrap(); let a = map.get(&a as &str); if a.is_none() { return "text/plain".to_string(); } a.unwrap().to_string() } static START: Once = Once::new(); //pub static MIMETYPES:Storage>> = Storage::new(); pub static MIMETYPES:RwLock>> = RwLock::new(None); fn xxx() {