From d7d97a613ea822f2cd61f7e02d457703c0c5ba7f Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sat, 7 Aug 2021 16:10:07 +0200 Subject: [PATCH] Adjust `Json` docs --- src/json.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/json.rs b/src/json.rs index 1c99b774..1ad4a7be 100644 --- a/src/json.rs +++ b/src/json.rs @@ -33,8 +33,6 @@ use std::ops::{Deref, DerefMut}; /// /// async fn create_user(extract::Json(payload): extract::Json) { /// // payload is a `CreateUser` -/// -/// // ... /// } /// /// let app = route("/users", post(create_user)); @@ -59,12 +57,18 @@ use std::ops::{Deref, DerefMut}; /// /// #[derive(Serialize)] /// struct User { -/// name: String, -/// email: String, +/// id: Uuid, +/// username: String, /// } /// /// async fn get_user(Path(user_id) : Path) -> Json { -/// todo!() +/// let user = find_user(user_id).await; +/// Json(user) +/// } +/// +/// async fn find_user(user_id: Uuid) -> User { +/// // ... +/// # unimplemented!() /// } /// /// let app = route("/users/:id", get(get_user));