refactor(header): make Quality an opaque struct
This makes the `u16` in `Quality` private, since it only has a valid range of 0-1000, and can't be enforced in public. The `q` function now allows both `f32`s and `u16`s to construct a `Quality`. BREAKING CHANGE: Any use of `Quality(num)` should change to `q(num)`.
This commit is contained in:
		| @@ -45,14 +45,14 @@ header! { | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AcceptEncoding, Encoding, QualityItem, Quality, qitem}; | ||||
|     /// use hyper::header::{Headers, AcceptEncoding, Encoding, QualityItem, q, qitem}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set( | ||||
|     ///     AcceptEncoding(vec![ | ||||
|     ///         qitem(Encoding::Chunked), | ||||
|     ///         QualityItem::new(Encoding::Gzip, Quality(600)), | ||||
|     ///         QualityItem::new(Encoding::EncodingExt("*".to_owned()), Quality(0)), | ||||
|     ///         QualityItem::new(Encoding::Gzip, q(600)), | ||||
|     ///         QualityItem::new(Encoding::EncodingExt("*".to_owned()), q(0)), | ||||
|     ///     ]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user