From 782e6ed7346a4a15575ef7ef6a47ea5937c5091f Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 9 Feb 2021 06:48:36 +0000 Subject: [PATCH] update changelog --- actix-http/CHANGES.md | 10 ++++++++++ actix-http/src/header/as_name.rs | 2 ++ actix-http/src/header/map.rs | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 52980fb5d..8ebba99a4 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -7,6 +7,9 @@ * `ResponseBuilder::append_header` method which allows using typed headers. [#1869] * `TestRequest::insert_header` method which allows using typed headers. [#1869] * `ContentEncoding` implements all necessary header traits. [#1912] +* `HeaderMap::len_keys` has the behavior of the old `len` method. [#1964] +* `HeaderMap::drain` as an efficient draining iterator. [#1964] +* Implement `IntoIterator` for owned `HeaderMap`. [#1964] ### Changed * `ResponseBuilder::content_type` now takes an `impl IntoHeaderValue` to support using typed @@ -19,6 +22,9 @@ * `client::error::ConnectError` Resolver variant contains `Box` type [#1905] * `client::ConnectorConfig` default timeout changed to 5 seconds. [#1905] * Simplify `BlockingError` type to a struct. It's only triggered with blocking thread pool is dead. [#1957] +* `HeaderMap::len` now returns number of values instead of number of keys. [#1964] +* `HeaderMap::insert` now returns iterator of removed values. [#1964] +* `HeaderMap::remove` now returns iterator of removed values. [#1964] ### Removed * `ResponseBuilder::set`; use `ResponseBuilder::insert_header`. [#1869] @@ -27,6 +33,9 @@ * `TestRequest::with_hdr`; use `TestRequest::default().insert_header()`. [#1869] * `TestRequest::with_header`; use `TestRequest::default().insert_header()`. [#1869] +### Documentation +* Vastly improve docs and add examples for `HeaderMap`. [#1964] + [#1869]: https://github.com/actix/actix-web/pull/1869 [#1894]: https://github.com/actix/actix-web/pull/1894 [#1903]: https://github.com/actix/actix-web/pull/1903 @@ -34,6 +43,7 @@ [#1905]: https://github.com/actix/actix-web/pull/1905 [#1912]: https://github.com/actix/actix-web/pull/1912 [#1957]: https://github.com/actix/actix-web/pull/1957 +[#1964]: https://github.com/actix/actix-web/pull/1964 ## 3.0.0-beta.1 - 2021-01-07 diff --git a/actix-http/src/header/as_name.rs b/actix-http/src/header/as_name.rs index 160505ae1..68456e3f7 100644 --- a/actix-http/src/header/as_name.rs +++ b/actix-http/src/header/as_name.rs @@ -1,3 +1,5 @@ +//! Helper trait for types that can be effectively borrowed as a [HeaderValue]. + use std::{borrow::Cow, str::FromStr}; use http::header::{HeaderName, InvalidHeaderName}; diff --git a/actix-http/src/header/map.rs b/actix-http/src/header/map.rs index 04db7b57a..106e44edb 100644 --- a/actix-http/src/header/map.rs +++ b/actix-http/src/header/map.rs @@ -1,5 +1,4 @@ -//! A multi-value [`HeaderMap`], its iterators, and a helper trait for types that can be effectively -//! borrowed as, or converted to, a [HeaderValue]. +//! A multi-value [`HeaderMap`] and its iterators. use std::{borrow::Cow, collections::hash_map, ops}; @@ -312,6 +311,8 @@ impl HeaderMap { GetAll::new(self.get_value(key)) } + // TODO: get_all_mut ? + /// Returns `true` if the map contains a value for the specified key. /// /// Invalid header names will simply return false.