1 2 3 4 5 6 7 8 9 10 11 12 13
use axum::http::StatusCode; pub struct JsonResponse<T> { code: StatusCode, message: String, data: T, } impl From<T> for JsonResponse<T> { fn from(data: T) -> Self { Self { code: StatusCode::OK, message: String::new(), data } } }