mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Improve value and reference passing efficiency (#3406)
This commit is contained in:
@@ -206,7 +206,7 @@ impl IntoResponseParts for CookieJar {
|
||||
type Error = Infallible;
|
||||
|
||||
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
||||
set_cookies(self.jar, res.headers_mut());
|
||||
set_cookies(&self.jar, res.headers_mut());
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ impl IntoResponse for CookieJar {
|
||||
}
|
||||
}
|
||||
|
||||
fn set_cookies(jar: cookie::CookieJar, headers: &mut HeaderMap) {
|
||||
fn set_cookies(jar: &cookie::CookieJar, headers: &mut HeaderMap) {
|
||||
for cookie in jar.delta() {
|
||||
if let Ok(header_value) = cookie.encoded().to_string().parse() {
|
||||
headers.append(SET_COOKIE, header_value);
|
||||
|
||||
@@ -274,7 +274,7 @@ impl<K> IntoResponseParts for PrivateCookieJar<K> {
|
||||
type Error = Infallible;
|
||||
|
||||
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
||||
set_cookies(self.jar, res.headers_mut());
|
||||
set_cookies(&self.jar, res.headers_mut());
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ impl<K> IntoResponseParts for SignedCookieJar<K> {
|
||||
type Error = Infallible;
|
||||
|
||||
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
||||
set_cookies(self.jar, res.headers_mut());
|
||||
set_cookies(&self.jar, res.headers_mut());
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user