Skip to content

Commit f2f91c7

Browse files

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/header/map.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ pub use self::into_header_name::IntoHeaderName;
2727
/// # use http::HeaderMap;
2828
/// # use http::header::{CONTENT_LENGTH, HOST, LOCATION};
2929
/// # 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());
3434
///
3535
/// assert!(headers.contains_key(HOST));
3636
/// assert!(!headers.contains_key(LOCATION));
@@ -1744,15 +1744,15 @@ impl<T> Sealed for HeaderMap<T> {}
17441744
/// let bad_headers: Result<HeaderMap> = HeaderMap::try_from(&headers_hashmap);
17451745
/// assert!(bad_headers.is_err());
17461746
/// ```
1747-
impl<COLLECTION, K, V> HttpTryFrom<COLLECTION> for HeaderMap<HeaderValue>
1747+
impl<C, K, V> HttpTryFrom<C> for HeaderMap<HeaderValue>
17481748
where
1749-
COLLECTION: IntoIterator<Item=(K, V)>,
1749+
C: IntoIterator<Item=(K, V)>,
17501750
HeaderName: HttpTryFrom<K>,
17511751
HeaderValue: HttpTryFrom<V>
17521752
{
17531753
type Error = Error;
17541754

1755-
fn try_from(c: COLLECTION) -> Result<Self, Self::Error> {
1755+
fn try_from(c: C) -> Result<Self, Self::Error> {
17561756
c.into_iter()
17571757
.map(|(k, v)| -> ::Result<(HeaderName, HeaderValue)> {
17581758
let name : HeaderName = k.http_try_into()?;

0 commit comments

Comments
 (0)