~repos /rust-embed

#rust#proc-macro#http

git clone https://pyrossh.dev/repos/rust-embed.git
Discussions: https://groups.google.com/g/rust-embed-devs

rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.


Files changed (3) hide show
  1. Cargo.toml +4 -4
  2. examples/rocket.rs +3 -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.1", default-features = false, optional = true }
60
+ rocket = { version = "0.5.0-rc.2", default-features = false, optional = true }
61
- axum = { version = "0.4", default-features = false, features = ["http1"], optional = true }
61
+ axum = { version = "0.5", default-features = false, features = ["http1"], optional = true }
62
- poem = { version = "1.3.18", default-features = false, features = ["server"], optional = true }
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.9"
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::Html;
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<Html<Cow<'static, [u8]>>> {
17
+ fn index() -> Option<RawHtml<Cow<'static, [u8]>>> {
18
18
  let asset = Asset::get("index.html")?;
19
- Some(Html(asset.data))
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.9"
16
+ sha2 = "0.10"
17
17
 
18
18
  [dependencies.globset]
19
19
  version = "0.4.8"