Skip to content

Commit

Permalink
Axum-0.7 compatibility, closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
imbolc committed Dec 2, 2023
1 parent fe37247 commit 8b6ed12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tower-request-id"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
description = "A tower (hyper, axum, warp) service to add a unique id for every request"
keywords = ["tower", "hyper", "axum", "warp"]
Expand All @@ -9,17 +9,17 @@ readme = "README.md"
repository = "https://github.com/imbolc/tower-request-id"

[dependencies]
http = "0.2"
http = "1"
tower-layer = "0.3"
tower-service = "0.3"
ulid = "1"

[dev-dependencies]
axum = "0.6"
axum = "0.7"
tokio = { version = "1", features = ["full"] }
tower = "0.4"
tracing-subscriber = "0.3"
tower-http = { version = "0.3", features = ["trace"] }
tower-http = { version = "0.5", features = ["trace"] }
rusty-hook = "0.11"
hyper = "0.14"
hyper = "1"
tracing = "0.1"
9 changes: 3 additions & 6 deletions examples/logging.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use axum::{routing::get, Router};
use axum::{body::Body, routing::get, Router};
use http::Request;
use hyper::Body;
use tower_http::trace::TraceLayer;
use tower_request_id::{RequestId, RequestIdLayer};
use tracing::{error_span, info, Level};
Expand Down Expand Up @@ -33,10 +32,8 @@ async fn main() {
// Note that it should be added after the Trace layer.
.layer(RequestIdLayer);

axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}

async fn handler() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tower_service::Service;
use ulid::Ulid;

/// A newtype around [`ulid::Ulid`]
#[derive(Debug)]
#[derive(Debug, Clone)]

This comment has been minimized.

Copy link
@thomasmost

thomasmost Dec 18, 2023

omg, thank goodness

pub struct RequestId(pub Ulid);

impl RequestId {
Expand Down

0 comments on commit 8b6ed12

Please sign in to comment.