File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,6 @@ use download::{download_mimes, parse_mimes};
35
35
36
36
mod download;
37
37
38
- pub struct RawMediaType {
39
- pub type_ : & ' static str ,
40
- pub subtype : & ' static str
41
- }
42
-
43
-
44
38
#[ plugin_registrar]
45
39
#[ doc( hidden) ]
46
40
pub fn plugin_registrar ( reg : & mut Registry ) {
Original file line number Diff line number Diff line change 12
12
#[ phase( plugin) ] extern crate phf_mac;
13
13
14
14
extern crate http;
15
- extern crate generator;
16
15
extern crate phf;
17
16
18
- use generator:: RawMediaType ;
19
17
use http:: headers:: content_type:: MediaType ;
20
18
21
19
static MIMES : phf:: Map < & ' static str , RawMediaType >
22
20
= mime_map ! ( "http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types" ) ;
23
21
22
+ // Generator uses RawMediaType unhygiencally. We could create another
23
+ // crate and put it there, but sticking the definition here is much
24
+ // easier.
25
+ //
26
+ // That said, this is a hack to avoid having to link against generator
27
+ // after compile-time.
28
+ struct RawMediaType {
29
+ pub type_ : & ' static str ,
30
+ pub subtype : & ' static str
31
+ }
32
+
24
33
/// Get the rust-http MediaType associated with this extension.
25
34
pub fn get_content_type ( ext : & str ) -> Option < MediaType > {
26
35
MIMES . find_equiv ( ext)
@@ -40,3 +49,4 @@ fn test_basic() {
40
49
assert_eq ! ( get_content_type( "flv" ) . unwrap( ) ,
41
50
MediaType { type_: "video" . to_string( ) , subtype: "x-flv" . to_string( ) , parameters: vec![ ] } ) ;
42
51
}
52
+
You can’t perform that action at this time.
0 commit comments