Skip to content

Commit

Permalink
Merge pull request #134 from H1rono/renovate/axum-0.x
Browse files Browse the repository at this point in the history
Update Rust crate axum to 0.8
  • Loading branch information
H1rono authored Jan 6, 2025
2 parents ac795d6 + 020f418 commit cce34a1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
14 changes: 6 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/bot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Arc;

use http::Request;
use tower::util::BoxCloneSyncService;
use traq_bot_http::RequestParser;

use domain::Infra;
Expand Down Expand Up @@ -37,7 +38,7 @@ impl<I: Infra> Bot<I> for BotImpl {
fn build_service<B>(
self,
infra: Arc<I>,
) -> tower::util::BoxCloneService<http::Request<B>, http::Response<String>, domain::Error>
) -> BoxCloneSyncService<http::Request<B>, http::Response<String>, domain::Error>
where
B: http_body::Body + Send + 'static,
B::Data: Send + 'static,
Expand All @@ -57,7 +58,7 @@ impl<I: Infra> Bot<I> for BotImpl {
.map_request(|r: Request<B>| r)
.map_err(Error::TraqBot)
.map_err(domain::Error::from);
handler.boxed_clone()
BoxCloneSyncService::new(handler)
}
}

Expand Down
2 changes: 1 addition & 1 deletion router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ serde_json.workspace = true
tracing.workspace = true
async-trait = "0.1"
http.workspace = true
axum.version = "0.7"
axum.version = "0.8"
axum.default-features = false
axum.features = ["tokio", "http1", "matched-path", "tower-log", "tracing", "json"]

Expand Down
11 changes: 7 additions & 4 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ where
});
Router::new()
.route("/bot", bot_service)
.route("/wh/:id", get(get_wh::<AppStateImpl<I, A::WebhookHandler>>))
.route(
"/wh/:id/github",
"/wh/{id}",
get(get_wh::<AppStateImpl<I, A::WebhookHandler>>),
)
.route(
"/wh/{id}/github",
post(wh_github::<AppStateImpl<I, A::WebhookHandler>>),
)
.route(
"/wh/:id/gitea",
"/wh/{id}/gitea",
post(wh_gitea::<AppStateImpl<I, A::WebhookHandler>>),
)
.route(
"/wh/:id/clickup",
"/wh/{id}/clickup",
post(wh_clickup::<AppStateImpl<I, A::WebhookHandler>>),
)
.with_state(state)
Expand Down
2 changes: 0 additions & 2 deletions router/src/webhook.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use async_trait::async_trait;
use axum::{
extract::{FromRequestParts, Path, State},
response::IntoResponse,
Expand Down Expand Up @@ -37,7 +36,6 @@ impl IntoResponse for WhRejection {
}
}

#[async_trait]
impl<S> FromRequestParts<S> for Wh
where
S: AppState,
Expand Down
4 changes: 2 additions & 2 deletions usecases/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use http::{Request, Response};
use http_body::Body;
use tower::util::BoxCloneService;
use tower::util::BoxCloneSyncService;

use domain::Infra;

Expand All @@ -11,7 +11,7 @@ pub trait Bot<I: Infra> {
fn build_service<B>(
self,
infra: Arc<I>,
) -> BoxCloneService<Request<B>, Response<String>, domain::Error>
) -> BoxCloneSyncService<Request<B>, Response<String>, domain::Error>
where
B: Body + Send + 'static,
B::Data: Send + 'static,
Expand Down

0 comments on commit cce34a1

Please sign in to comment.