~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.
13bdf24f
—
Mark Drobnak 3 years ago
Merge pull request #179 from acim/feature/bump-deps
- Cargo.toml +4 -4
- examples/rocket.rs +3 -3
- utils/Cargo.toml +1 -1
Cargo.toml
CHANGED
|
@@ -57,13 +57,13 @@ mime_guess = { version = "2", optional = true }
|
|
|
57
57
|
hex = { version = "0.4.3", optional = true }
|
|
58
58
|
tokio = { version = "1.0", optional = true, features = ["macros", "rt-multi-thread"] }
|
|
59
59
|
warp = { version = "0.3", default-features = false, optional = true }
|
|
60
|
-
rocket = { version = "0.5.0-rc.
|
|
60
|
+
rocket = { version = "0.5.0-rc.2", default-features = false, optional = true }
|
|
61
|
-
axum = { version = "0.
|
|
61
|
+
axum = { version = "0.5", default-features = false, features = ["http1"], optional = true }
|
|
62
|
-
poem = { version = "1.3.
|
|
62
|
+
poem = { version = "1.3.30", default-features = false, features = ["server"], optional = true }
|
|
63
63
|
salvo = { version = "0.16", default-features = false, optional = true }
|
|
64
64
|
|
|
65
65
|
[dev-dependencies]
|
|
66
|
-
sha2 = "0.
|
|
66
|
+
sha2 = "0.10"
|
|
67
67
|
|
|
68
68
|
[features]
|
|
69
69
|
debug-embed = ["rust-embed-impl/debug-embed", "rust-embed-utils/debug-embed"]
|
examples/rocket.rs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
extern crate rocket;
|
|
3
3
|
|
|
4
4
|
use rocket::http::ContentType;
|
|
5
|
-
use rocket::response::content::
|
|
5
|
+
use rocket::response::content::RawHtml;
|
|
6
6
|
use rust_embed::RustEmbed;
|
|
7
7
|
|
|
8
8
|
use std::borrow::Cow;
|
|
@@ -14,9 +14,9 @@ use std::path::PathBuf;
|
|
|
14
14
|
struct Asset;
|
|
15
15
|
|
|
16
16
|
#[get("/")]
|
|
17
|
-
fn index() -> Option<
|
|
17
|
+
fn index() -> Option<RawHtml<Cow<'static, [u8]>>> {
|
|
18
18
|
let asset = Asset::get("index.html")?;
|
|
19
|
-
Some(
|
|
19
|
+
Some(RawHtml(asset.data))
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
#[get("/dist/<file..>")]
|
utils/Cargo.toml
CHANGED
|
@@ -13,7 +13,7 @@ edition = "2018"
|
|
|
13
13
|
|
|
14
14
|
[dependencies]
|
|
15
15
|
walkdir = "2.3.1"
|
|
16
|
-
sha2 = "0.
|
|
16
|
+
sha2 = "0.10"
|
|
17
17
|
|
|
18
18
|
[dependencies.globset]
|
|
19
19
|
version = "0.4.8"
|