mirror of https://github.com/fafhrd91/actix-web
docs: update changelog
This commit is contained in:
parent
15ce0c73f4
commit
4aab56dc01
|
@ -5,6 +5,7 @@
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add `header::CLEAR_SITE_DATA` constant.
|
- Add `header::CLEAR_SITE_DATA` constant.
|
||||||
|
- Add `Extensions::get_or_insert[_with]()` methods.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -104,14 +104,17 @@ impl Extensions {
|
||||||
.and_then(|boxed| boxed.downcast_mut())
|
.and_then(|boxed| boxed.downcast_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a mutable reference or insert an item of a given type.
|
/// Inserts the given `value` into the extensions if it is not present, then returns a reference
|
||||||
|
/// to the value in the extensions.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use actix_http::Extensions;
|
/// # use actix_http::Extensions;
|
||||||
/// let mut map = Extensions::new();
|
/// let mut map = Extensions::new();
|
||||||
/// assert_eq!(map.get::<Vec<u32>>(), None);
|
/// assert_eq!(map.get::<Vec<u32>>(), None);
|
||||||
|
///
|
||||||
/// map.get_or_insert(Vec::<u32>::new()).push(1);
|
/// map.get_or_insert(Vec::<u32>::new()).push(1);
|
||||||
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1]));
|
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1]));
|
||||||
|
///
|
||||||
/// map.get_or_insert(Vec::<u32>::new()).push(2);
|
/// map.get_or_insert(Vec::<u32>::new()).push(2);
|
||||||
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1,2]));
|
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1,2]));
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -123,14 +126,17 @@ impl Extensions {
|
||||||
.expect("extensions map to always contain value T")
|
.expect("extensions map to always contain value T")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a mutable reference or insert an item of a given type calculated with the closure given.
|
/// Inserts a value computed from `f` into the extensions if the given `value` is not present,
|
||||||
|
/// then returns a reference to the value in the extensions.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use actix_http::Extensions;
|
/// # use actix_http::Extensions;
|
||||||
/// let mut map = Extensions::new();
|
/// let mut map = Extensions::new();
|
||||||
/// assert_eq!(map.get::<Vec<u32>>(), None);
|
/// assert_eq!(map.get::<Vec<u32>>(), None);
|
||||||
|
///
|
||||||
/// map.get_or_insert_with(Vec::<u32>::new).push(1);
|
/// map.get_or_insert_with(Vec::<u32>::new).push(1);
|
||||||
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1]));
|
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1]));
|
||||||
|
///
|
||||||
/// map.get_or_insert_with(Vec::<u32>::new).push(2);
|
/// map.get_or_insert_with(Vec::<u32>::new).push(2);
|
||||||
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1,2]));
|
/// assert_eq!(map.get::<Vec<u32>>(), Some(&vec![1,2]));
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
||||||
- Update `brotli` dependency to `7`.
|
- Update `brotli` dependency to `7`.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||||
- Added `Extensions::get_or_insert` and `Extensions::get_or_insert_with`
|
|
||||||
|
|
||||||
## 4.9.0
|
## 4.9.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue