From 0c629764a80c9dc41bf2d7691f619f692e58c46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=90=E5=AE=B6?= Date: Sat, 12 Oct 2024 19:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- macro/src/responsable.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/macro/src/responsable.rs b/macro/src/responsable.rs index 5b3d253..68b776a 100644 --- a/macro/src/responsable.rs +++ b/macro/src/responsable.rs @@ -22,11 +22,7 @@ pub fn gen_responsable(input: DeriveInput) -> TokenStream { impl #impl_generics axum::response::IntoResponse for #name #generics #where_clause { fn into_response(self) -> axum::http::Response { let mut builder = hyper::Response::builder(); - // .status(#status) // 设置状态码 - // .headers(#headers); // 设置头部信息 - let body = serde_json::to_string(&self).expect("Failed to serialize response"); // 序列化结构体为JSON字符串 - axum::http::Response::new(axum::body::Body::from(body)) // 构建响应 } } @@ -39,12 +35,7 @@ pub fn gen_responsable(input: DeriveInput) -> TokenStream { quote! { impl #impl_generics axum::response::IntoResponse for #name #generics #where_clause { fn into_response(self) -> axum::http::Response { - // let mut builder = hyper::Response::builder(); - // .status(#status) // 设置状态码 - // .headers(#headers); // 设置头部信息 - let body = serde_json::to_string(&self).expect("Failed to serialize response"); // 序列化结构体为JSON字符串 - axum::http::Response::new(axum::body::Body::from(body)) // 构建响应 } } @@ -57,12 +48,7 @@ pub fn gen_responsable(input: DeriveInput) -> TokenStream { quote! { impl #impl_generics axum::response::IntoResponse for #name #generics #where_clause { fn into_response(self) -> axum::http::Response { - // let mut builder = hyper::Response::builder(); - // .status(#status) // 设置状态码 - // .headers(#headers); // 设置头部信息 - let body = serde_json::to_string(&self).expect("Failed to serialize response"); // 序列化结构体为JSON字符串 - axum::http::Response::new(hyper::body::Body::from(body)) // 构建响应 } }