Replaced async_trait with async in traits from 2024 edition

This commit is contained in:
2025-03-07 22:40:10 +01:00
parent 2f1eb4df3a
commit 5a77407297
16 changed files with 90 additions and 127 deletions

View File

@ -1,14 +1,13 @@
use {
crate::{serde::response::BaseResponse, serde::traits::DeserializeInto},
async_trait::async_trait,
axum::{
Json,
body::to_bytes,
response::{IntoResponse, Response},
Json,
},
serde::{
de::{DeserializeOwned, Error},
Serialize,
de::{DeserializeOwned, Error},
},
};
@ -18,7 +17,6 @@ impl<T: Serialize> IntoResponse for BaseResponse<T> {
}
}
#[async_trait]
impl DeserializeInto for Response {
async fn deserialize_into<T: DeserializeOwned>(self) -> Result<T, serde_json::Error> {
let body = to_bytes(self.into_body(), usize::MAX).await.map_err(|e| {

View File

@ -13,8 +13,8 @@
/// use lib::router;
/// async fn simplify(path: axum::extract::path::Path<String>) {}
/// router!("/simplify", lib::routes!(
/// get "/:exp" => simplify,
/// get "/table/:exp" => || async {}
/// get "/{exp}" => simplify,
/// get "/table/{exp}" => async || {}
/// ));
/// ```
#[macro_export]
@ -92,8 +92,8 @@ macro_rules! join_routes {
#[cfg(test)]
mod tests {
use axum::extract::State;
use axum::Router;
use axum::extract::State;
async fn index() {}