mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
axum-extra: Use impl Into<Cookie> (#2348)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user