Repository: pyrossh/rust-embed (language: rust)

Issue:
Axum example is depricated.
Hi!
```
type Body = Full<Bytes>;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `IntoResponse`
```

Looks like the example based on axum version 0.2.8 but IntoResponse changed since [0.3](https://github.com/tokio-rs/axum/pull/448) 

So in current axum 0.4 it does not compile.


Discussion / hints:
@makorne would you be interested in making a PR for this?
Sorry I am just trying axum and I have not enough skills.  

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index c5f4b73..b7d4ee5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -58,7 +58,7 @@ hex = { version = "0.4.3", optional = true }
 tokio = { version = "1.0", optional = true, features = ["macros", "rt-multi-thread"] }
 warp = { version = "0.3", default-features = false, optional = true }
 rocket = { version = "0.4.5", default-features = false, optional = true }
-axum = { version = "0.2.3", default-features = false, optional = true  }
+axum = { version = "0.4", default-features = false, features = ["http1"], optional = true  }
 poem = { version = "1.0.8", default-features = false, optional = true  }
 
 [dev-dependencies]
diff --git a/examples/axum.rs b/examples/axum.rs
index 6f45f61..1c70de7 100644
--- a/examples/axum.rs
+++ b/examples/axum.rs
@@ -1,14 +1,10 @@
-use std::convert::Infallible;
-
 use axum::{
-  body::{Bytes, Full},
-  handler::get,
-  http::{header, Response, StatusCode, Uri},
-  response::{Html, IntoResponse},
-  routing::Router,
+  body::{boxed, Full},
+  handler::Handler,
+  http::{header, StatusCode, Uri},
+  response::{Html, IntoResponse, Response},
+  routing::{get, Router},
 };
-
-use axum::handler::Handler;
 use mime_guess;
 use rust_embed::RustEmbed;
 use std::net::SocketAddr;
@@ -22,7 +18,7 @@ async fn main() {
     .route("/", get(index_handler))
     .route("/index.html", get(index_handler))
     .route("/dist/", static_handler.into_service())
-    .or(static_handler.into_service());
+    .fallback(static_handler.into_service());
 
   // run it
   let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
@@ -57,18 +53,15 @@ impl<T> IntoResponse for StaticFile<T>
 where
   T: Into<String>,
 {
-  type Body = Full<Bytes>;
-  type BodyError = Infallible;
-
-  fn into_response(self) -> Response<Self::Body> {
+  fn into_response(self) -> Response {
     let path = self.0.into();
     match Asset::get(path.as_str()) {
       Some(content) => {
-        let body = content.data.into();
+        let body = boxed(Full::from(content.data));
         let mime = mime_guess::from_path(path).first_or_octet_stream();
         Response::builder().header(header::CONTENT_TYPE, mime.as_ref()).body(body).unwrap()
       }
-      None => Response::builder().status(StatusCode::NOT_FOUND).body(Full::from("404")).unwrap(),
+      None => Response::builder().status(StatusCode::NOT_FOUND).body(boxed(Full::from("404"))).unwrap(),
     }
   }
 }


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 855af2d..c32b5fb 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -37,8 +37,10 @@ jobs:
           cargo test --test interpolated_path --features "interpolate-folder-path" --release
           cargo build --example basic
           cargo build --example actix --features actix
+          cargo build --example axum --features axum-ex
           cargo build --example warp --features warp-ex
           cargo test --test lib --release
           cargo build --example basic --release
           cargo build --example actix --features actix --release
+          cargo build --example axum --features axum-ex --release
           cargo build --example warp --features warp-ex --release