11use crate :: gen_resp:: gen_response;
2- use hyper:: { body:: HttpBody , Response , StatusCode } ;
2+ use http:: { Response , StatusCode } ;
3+ use http_body:: Body as HttpBody ;
34use serde:: Serialize ;
45
56const STATUS_FAILED : & ' static str = "failed" ;
@@ -30,7 +31,7 @@ struct FailedResp {
3031/// use hyper::{Body, Request, Response, StatusCode};
3132/// use routerify_json_response::{json_failed_resp_with_message};
3233///
33- /// async fn list_books_handler(_: Request<Body>) -> Result<Response<Body>, routerify ::Error> {
34+ /// async fn list_books_handler(_: Request<Body>) -> Result<Response<Body>, routerify_json_response ::Error> {
3435/// // Generate a failed JSON response in the following format:
3536/// // { "status": "failed", code: 500, data: "Internal Server Error: Couldn't fetch book list from database" }
3637/// json_failed_resp_with_message(
@@ -39,7 +40,7 @@ struct FailedResp {
3940/// )
4041/// }
4142/// ```
42- pub fn json_failed_resp_with_message < B , M > ( code : StatusCode , message : M ) -> routerify :: Result < Response < B > >
43+ pub fn json_failed_resp_with_message < B , M > ( code : StatusCode , message : M ) -> crate :: Result < Response < B > >
4344where
4445 B : HttpBody + From < Vec < u8 > > + Send + Sync + Unpin + ' static ,
4546 M : Into < String > ,
@@ -71,13 +72,13 @@ where
7172/// use hyper::{Body, Request, Response, StatusCode};
7273/// use routerify_json_response::{json_failed_resp};
7374///
74- /// async fn list_books_handler(_: Request<Body>) -> Result<Response<Body>, routerify ::Error> {
75+ /// async fn list_books_handler(_: Request<Body>) -> Result<Response<Body>, routerify_json_response ::Error> {
7576/// // Generate a failed JSON response in the following format:
7677/// // { "status": "failed", code: 500, data: "Internal Server Error" }
7778/// json_failed_resp(StatusCode::INTERNAL_SERVER_ERROR)
7879/// }
7980/// ```
80- pub fn json_failed_resp < B > ( code : StatusCode ) -> routerify :: Result < Response < B > >
81+ pub fn json_failed_resp < B > ( code : StatusCode ) -> crate :: Result < Response < B > >
8182where
8283 B : HttpBody + From < Vec < u8 > > + Send + Sync + Unpin + ' static ,
8384{
0 commit comments