Skip to content

Commit

Permalink
chore: update to axum 0.5 (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpdrsn committed Mar 31, 2022
1 parent d4bd475 commit d142e1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tonic/Cargo.toml
Expand Up @@ -78,7 +78,7 @@ tokio = {version = "1.0.1", features = ["net"], optional = true}
tokio-stream = "0.1"
tower = {version = "0.4.7", features = ["balance", "buffer", "discover", "limit", "load", "make", "timeout", "util"], optional = true}
tracing-futures = {version = "0.2", optional = true}
axum = {version = "0.4", default_features = false, optional = true}
axum = {version = "0.5", default_features = false, optional = true}

# rustls
rustls-pemfile = { version = "0.3", optional = true }
Expand Down
13 changes: 9 additions & 4 deletions tonic/src/transport/service/router.rs
Expand Up @@ -8,6 +8,7 @@ use hyper::Body;
use pin_project::pin_project;
use std::{
convert::Infallible,
fmt,
future::Future,
pin::Pin,
task::{Context, Poll},
Expand Down Expand Up @@ -54,8 +55,7 @@ impl Routes {

async fn unimplemented() -> impl axum::response::IntoResponse {
let status = http::StatusCode::OK;
let headers =
axum::response::Headers([("grpc-status", "12"), ("content-type", "application/grpc")]);
let headers = [("grpc-status", "12"), ("content-type", "application/grpc")];
(status, headers)
}

Expand All @@ -75,8 +75,13 @@ impl Service<Request<Body>> for Routes {
}

#[pin_project]
#[derive(Debug)]
pub struct RoutesFuture(#[pin] axum::routing::future::RouterFuture<Body>);
pub struct RoutesFuture(#[pin] axum::routing::future::RouteFuture<Body, Infallible>);

impl fmt::Debug for RoutesFuture {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("RoutesFuture").finish()
}
}

impl Future for RoutesFuture {
type Output = Result<Response<BoxBody>, crate::Error>;
Expand Down

0 comments on commit d142e1a

Please sign in to comment.