axum-extra: Use impl Into<Cookie> (#2348)

This commit is contained in:
Michael Seele 2023-11-24 21:39:14 +01:00 committed by GitHub
parent 2402d4604b
commit e3d34bb553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

View file

@ -12,10 +12,12 @@ and this project adheres to [Semantic Versioning].
- **added:** `Clone` implementation for `ErasedJson` ([#2142])
- **breaking:** Update to prost 0.12. Used for the `Protobuf` extractor
- **breaking:** Make `tokio` an optional dependency
- **breaking**: Functions and methods that previously accepted a `Cookie` now accept any `T: Into<Cookie>` ([#2348])
[#1850]: https://github.com/tokio-rs/axum/pull/1850
[#2142]: https://github.com/tokio-rs/axum/pull/2142
[#2310]: https://github.com/tokio-rs/axum/pull/2310
[#2348]: https://github.com/tokio-rs/axum/pull/2348
# 0.7.4 (18. April, 2023)

View file

@ -172,7 +172,7 @@ impl CookieJar {
/// }
/// ```
#[must_use]
pub fn remove(mut self, cookie: Cookie<'static>) -> Self {
pub fn remove<C: Into<Cookie<'static>>>(mut self, cookie: C) -> Self {
self.jar.remove(cookie);
self
}
@ -193,7 +193,7 @@ impl CookieJar {
/// ```
#[must_use]
#[allow(clippy::should_implement_trait)]
pub fn add(mut self, cookie: Cookie<'static>) -> Self {
pub fn add<C: Into<Cookie<'static>>>(mut self, cookie: C) -> Self {
self.jar.add(cookie);
self
}

View file

@ -220,7 +220,7 @@ impl<K> PrivateCookieJar<K> {
/// }
/// ```
#[must_use]
pub fn remove(mut self, cookie: Cookie<'static>) -> Self {
pub fn remove<C: Into<Cookie<'static>>>(mut self, cookie: C) -> Self {
self.private_jar_mut().remove(cookie);
self
}
@ -241,7 +241,7 @@ impl<K> PrivateCookieJar<K> {
/// ```
#[must_use]
#[allow(clippy::should_implement_trait)]
pub fn add(mut self, cookie: Cookie<'static>) -> Self {
pub fn add<C: Into<Cookie<'static>>>(mut self, cookie: C) -> Self {
self.private_jar_mut().add(cookie);
self
}

View file

@ -238,7 +238,7 @@ impl<K> SignedCookieJar<K> {
/// }
/// ```
#[must_use]
pub fn remove(mut self, cookie: Cookie<'static>) -> Self {
pub fn remove<C: Into<Cookie<'static>>>(mut self, cookie: C) -> Self {
self.signed_jar_mut().remove(cookie);
self
}
@ -259,7 +259,7 @@ impl<K> SignedCookieJar<K> {
/// ```
#[must_use]
#[allow(clippy::should_implement_trait)]
pub fn add(mut self, cookie: Cookie<'static>) -> Self {
pub fn add<C: Into<Cookie<'static>>>(mut self, cookie: C) -> Self {
self.signed_jar_mut().add(cookie);
self
}