Skip to content

Commit

Permalink
fix retain doc test
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Jan 1, 2023
1 parent 427fc41 commit ddb8550
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions actix-http/src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,17 +562,14 @@ impl HeaderMap {
/// # use actix_http::header::{self, HeaderMap, HeaderValue};
/// let mut map = HeaderMap::new();
///
/// let mut iter = map.keys();
/// assert!(iter.next().is_none());
///
/// map.append(header::HOST, HeaderValue::from_static("duck.com"));
/// map.append(header::SET_COOKIE, HeaderValue::from_static("one=1"));
/// map.append(header::SET_COOKIE, HeaderValue::from_static("two=2"));
///
/// let keys = map.keys().cloned().collect::<Vec<_>>();
/// assert_eq!(keys.len(), 2);
/// assert!(keys.contains(&header::HOST));
/// assert!(keys.contains(&header::SET_COOKIE));
/// map.retain(|name, val| val.as_bytes().starts_with(b"one"));
///
/// assert_eq!(map.len(), 1);
/// assert!(map.contains_key(&header::SET_COOKIE));
/// ```
pub fn retain<F>(&mut self, mut retain_fn: F)
where
Expand Down

0 comments on commit ddb8550

Please sign in to comment.