@@ -27,10 +27,10 @@ pub use self::into_header_name::IntoHeaderName;
27
27
/// # use http::HeaderMap;
28
28
/// # use http::header::{CONTENT_LENGTH, HOST, LOCATION};
29
29
/// # use http::HttpTryFrom;
30
- /// let mut headers = HeaderMap::try_from(vec![
31
- /// (HOST, "example.com"),
32
- /// (CONTENT_LENGTH , "123")
33
- /// ] ).unwrap();
30
+ /// let mut headers = HeaderMap::new();
31
+ ///
32
+ /// headers.insert(HOST , "example.com".parse().unwrap());
33
+ /// headers.insert(CONTENT_LENGTH, "123".parse( ).unwrap() );
34
34
///
35
35
/// assert!(headers.contains_key(HOST));
36
36
/// assert!(!headers.contains_key(LOCATION));
@@ -1744,15 +1744,15 @@ impl<T> Sealed for HeaderMap<T> {}
1744
1744
/// let bad_headers: Result<HeaderMap> = HeaderMap::try_from(&headers_hashmap);
1745
1745
/// assert!(bad_headers.is_err());
1746
1746
/// ```
1747
- impl < COLLECTION , K , V > HttpTryFrom < COLLECTION > for HeaderMap < HeaderValue >
1747
+ impl < C , K , V > HttpTryFrom < C > for HeaderMap < HeaderValue >
1748
1748
where
1749
- COLLECTION : IntoIterator < Item =( K , V ) > ,
1749
+ C : IntoIterator < Item =( K , V ) > ,
1750
1750
HeaderName : HttpTryFrom < K > ,
1751
1751
HeaderValue : HttpTryFrom < V >
1752
1752
{
1753
1753
type Error = Error ;
1754
1754
1755
- fn try_from ( c : COLLECTION ) -> Result < Self , Self :: Error > {
1755
+ fn try_from ( c : C ) -> Result < Self , Self :: Error > {
1756
1756
c. into_iter ( )
1757
1757
. map ( |( k, v) | -> :: Result < ( HeaderName , HeaderValue ) > {
1758
1758
let name : HeaderName = k. http_try_into ( ) ?;
0 commit comments