~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.
a1865f7f
—
Paolo Barbolini 5 years ago
examples: update actix-web to 2.0
- Cargo.toml +3 -2
- examples/actix.rs +4 -4
Cargo.toml
CHANGED
|
@@ -17,7 +17,8 @@ rust-embed-impl = { version = "5.3.0", path = "impl"}
|
|
|
17
17
|
rust-embed-utils = { version = "5.0.0", path = "utils"}
|
|
18
18
|
|
|
19
19
|
include-flate = { version = "0.1", optional = true, features = ["stable"] }
|
|
20
|
-
actix-web = { version = "
|
|
20
|
+
actix-web = { version = "2", optional = true }
|
|
21
|
+
actix-rt = { version = "1", optional = true }
|
|
21
22
|
mime_guess = { version = "2", optional = true }
|
|
22
23
|
warp = { version = "0.1", optional = true }
|
|
23
24
|
rocket = { version = "0.4.2", optional = true }
|
|
@@ -27,7 +28,7 @@ debug-embed = ["rust-embed-impl/debug-embed", "rust-embed-utils/debug-embed"]
|
|
|
27
28
|
interpolate-folder-path = ["rust-embed-impl/interpolate-folder-path"]
|
|
28
29
|
compression = ["rust-embed-impl/compression", "include-flate"]
|
|
29
30
|
nightly = ["rocket"]
|
|
30
|
-
actix = ["actix-web", "mime_guess"]
|
|
31
|
+
actix = ["actix-web", "actix-rt", "mime_guess"]
|
|
31
32
|
warp-ex = ["warp", "mime_guess"]
|
|
32
33
|
|
|
33
34
|
[badges]
|
examples/actix.rs
CHANGED
|
@@ -31,14 +31,14 @@ fn dist(req: HttpRequest) -> HttpResponse {
|
|
|
31
31
|
handle_embedded_file(path)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
#[actix_rt::main]
|
|
35
|
+
async fn main() -> std::io::Result<()> {
|
|
35
36
|
HttpServer::new(|| {
|
|
36
37
|
App::new()
|
|
37
38
|
.service(web::resource("/").route(web::get().to(index)))
|
|
38
39
|
.service(web::resource("/dist/{_:.*}").route(web::get().to(dist)))
|
|
39
40
|
})
|
|
40
|
-
.bind("127.0.0.1:8000")
|
|
41
|
+
.bind("127.0.0.1:8000")?
|
|
41
|
-
.unwrap()
|
|
42
42
|
.run()
|
|
43
|
-
.
|
|
43
|
+
.await
|
|
44
44
|
}
|