~repos /rust-embed
git clone https://pyrossh.dev/repos/rust-embed.git
rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
2c88c439
—
Nguyễn Hồng Quân 2 years ago
Fix code format
examples/axum-spa/main.rs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use axum::{
|
|
2
2
|
http::{header, StatusCode, Uri},
|
|
3
|
-
response::{
|
|
3
|
+
response::{Html, IntoResponse, Response},
|
|
4
4
|
routing::Router,
|
|
5
5
|
};
|
|
6
6
|
use rust_embed::RustEmbed;
|
|
@@ -46,9 +46,7 @@ async fn static_handler(uri: Uri) -> impl IntoResponse {
|
|
|
46
46
|
|
|
47
47
|
async fn index_html() -> Response {
|
|
48
48
|
match Assets::get(INDEX_HTML) {
|
|
49
|
-
Some(content) => {
|
|
50
|
-
|
|
49
|
+
Some(content) => Html(content.data).into_response(),
|
|
51
|
-
}
|
|
52
50
|
None => not_found().await,
|
|
53
51
|
}
|
|
54
52
|
}
|