Use impl IntoResponse less in docs (#1049)

This commit is contained in:
David Pedersen
2022-05-22 13:41:29 +02:00
committed by GitHub
parent 1d7878c3c8
commit 19fe93262f
17 changed files with 88 additions and 47 deletions
+4 -4
View File
@@ -50,7 +50,7 @@ pub use cookie_lib::Key;
/// async fn create_session(
/// TypedHeader(auth): TypedHeader<Authorization<Bearer>>,
/// jar: CookieJar,
/// ) -> impl IntoResponse {
/// ) -> Result<(CookieJar, Redirect), StatusCode> {
/// if let Some(session_id) = authorize_and_create_session(auth.token()).await {
/// Ok((
/// // the updated jar must be returned for the changes
@@ -63,7 +63,7 @@ pub use cookie_lib::Key;
/// }
/// }
///
/// async fn me(jar: CookieJar) -> impl IntoResponse {
/// async fn me(jar: CookieJar) -> Result<(), StatusCode> {
/// if let Some(session_id) = jar.get("session_id") {
/// // fetch and render user...
/// # Ok(())
@@ -141,7 +141,7 @@ impl CookieJar {
/// use axum_extra::extract::cookie::{CookieJar, Cookie};
/// use axum::response::IntoResponse;
///
/// async fn handle(jar: CookieJar) -> impl IntoResponse {
/// async fn handle(jar: CookieJar) -> CookieJar {
/// jar.remove(Cookie::named("foo"))
/// }
/// ```
@@ -161,7 +161,7 @@ impl CookieJar {
/// use axum_extra::extract::cookie::{CookieJar, Cookie};
/// use axum::response::IntoResponse;
///
/// async fn handle(jar: CookieJar) -> impl IntoResponse {
/// async fn handle(jar: CookieJar) -> CookieJar {
/// jar.add(Cookie::new("foo", "bar"))
/// }
/// ```