Skip to content

Commit

Permalink
axum-extra: Use impl Into<Cookie> (#2348)
Browse files Browse the repository at this point in the history
  • Loading branch information
mseele authored Nov 24, 2023
1 parent 2402d46 commit e3d34bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions axum-extra/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions axum-extra/src/extract/cookie/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions axum-extra/src/extract/cookie/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions axum-extra/src/extract/cookie/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit e3d34bb

Please sign in to comment.