feat(mime): upgrade to mime v0.3
The new mime crate has several benefits: - Faster formatting - Easier to use. Most common mime types are now just constants, like `mime::TEXT_PLAIN`. - Proper suffix support. - Extensible without breaking backwards compatiblity. This means we can always add new constants, but before we couldn't add new variants to the enums. - It's now impossible for a `Mime` to contain invalid tokens. Before, with the `Ext(String)` variants, it was possible to create an illegal mime. Closes #738 BREAKING CHANGE: Most uses of `mime` will likely break. There is no more `mime!` macro, nor a `Mime` constructor, nor `TopLevel` and `SubLevel` enums. Instead, in most cases, a constant exists that can now be used. For less common mime types, they can be created by parsing a string.
This commit is contained in:
		| @@ -905,9 +905,7 @@ mod tests { | ||||
|     use http::{ServerTransaction, Http1Transaction}; | ||||
|     use bytes::BytesMut; | ||||
|  | ||||
|     use mime::Mime; | ||||
|     use mime::TopLevel::Text; | ||||
|     use mime::SubLevel::Plain; | ||||
|     use mime; | ||||
|  | ||||
|     #[test] | ||||
|     fn test_link() { | ||||
| @@ -956,7 +954,7 @@ mod tests { | ||||
|             .push_media_desc(MediaDesc::Screen) | ||||
|             .set_title("previous chapter") | ||||
|             .set_title_star("title* unparsed") | ||||
|             .set_media_type(Mime(Text, Plain, vec![])); | ||||
|             .set_media_type(mime::TEXT_PLAIN); | ||||
|  | ||||
|         let link_header = b"<http://example.com/TheBook/chapter2>; \ | ||||
|             rel=\"previous\"; anchor=\"../anchor/example/\"; \ | ||||
| @@ -1015,7 +1013,7 @@ mod tests { | ||||
|             .push_media_desc(MediaDesc::Screen) | ||||
|             .set_title("previous chapter") | ||||
|             .set_title_star("title* unparsed") | ||||
|             .set_media_type(Mime(Text, Plain, vec![])); | ||||
|             .set_media_type(mime::TEXT_PLAIN); | ||||
|  | ||||
|         let link = Link::new(vec![link_value]); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user