1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-30 08:24:28 +02:00

update changelog

This commit is contained in:
Rob Ede
2021-12-07 21:26:28 +00:00
parent d5ad250193
commit d7a1b434cb
6 changed files with 23 additions and 15 deletions

View File

@ -16,6 +16,8 @@
* `impl Display` for `header::Quality`. [#2486]
* Connection data set through the `on_connect_ext` callbacks is now accessible only from the new `Request::conn_data()` method. [#2491]
* `Request::take_conn_data()`. [#2491]
* `Request::take_req_data()`. [#2487]
* `impl Clone` for `RequestHead`. [#2487]
### Changed
* Rename `body::BoxBody::{from_body => new}`. [#2468]
@ -40,6 +42,7 @@
[#2468]: https://github.com/actix/actix-web/pull/2468
[#1920]: https://github.com/actix/actix-web/pull/1920
[#2486]: https://github.com/actix/actix-web/pull/2486
[#2487]: https://github.com/actix/actix-web/pull/2487
[#2488]: https://github.com/actix/actix-web/pull/2488
[#2491]: https://github.com/actix/actix-web/pull/2491

View File

@ -19,8 +19,7 @@ impl Extensions {
#[inline]
pub fn new() -> Extensions {
Extensions {
map: AHashMap::with_capacity(2),
// map: AHashMap::new(),
map: AHashMap::new(),
}
}

View File

@ -2,7 +2,7 @@
use std::{
cell::{Ref, RefCell, RefMut},
fmt, net,
fmt, mem, net,
rc::Rc,
str,
};
@ -22,7 +22,7 @@ pub struct Request<P = PayloadStream> {
pub(crate) payload: Payload<P>,
pub(crate) head: Message<RequestHead>,
pub(crate) conn_data: Option<Rc<Extensions>>,
pub req_data: RefCell<Extensions>,
pub(crate) req_data: RefCell<Extensions>,
}
impl<P> HttpMessage for Request<P> {
@ -34,7 +34,7 @@ impl<P> HttpMessage for Request<P> {
}
fn take_payload(&mut self) -> Payload<P> {
std::mem::replace(&mut self.payload, Payload::None)
mem::replace(&mut self.payload, Payload::None)
}
/// Request extensions
@ -55,7 +55,7 @@ impl From<Message<RequestHead>> for Request<PayloadStream> {
Request {
head,
payload: Payload::None,
req_data: RefCell::new(Extensions::new()),
req_data: RefCell::new(Extensions::default()),
conn_data: None,
}
}
@ -67,7 +67,7 @@ impl Request<PayloadStream> {
Request {
head: Message::new(),
payload: Payload::None,
req_data: RefCell::new(Extensions::new()),
req_data: RefCell::new(Extensions::default()),
conn_data: None,
}
}
@ -79,7 +79,7 @@ impl<P> Request<P> {
Request {
payload,
head: Message::new(),
req_data: RefCell::new(Extensions::new()),
req_data: RefCell::new(Extensions::default()),
conn_data: None,
}
}
@ -106,7 +106,7 @@ impl<P> Request<P> {
/// Get request's payload
pub fn take_payload(&mut self) -> Payload<P> {
std::mem::replace(&mut self.payload, Payload::None)
mem::replace(&mut self.payload, Payload::None)
}
/// Split request into request head and payload
@ -203,6 +203,11 @@ impl<P> Request<P> {
pub fn take_conn_data(&mut self) -> Option<Rc<Extensions>> {
self.conn_data.take()
}
/// Returns the request data container, leaving an empty one in it's place.
pub fn take_req_data(&mut self) -> Extensions {
mem::take(&mut self.req_data.get_mut())
}
}
impl<P> fmt::Debug for Request<P> {