~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 (4) hide show
  1. Cargo.lock +1 -1
  2. Cargo.toml +1 -1
  3. examples/rouille.rs +21 -0
  4. readme.md +1 -1
Cargo.lock CHANGED
@@ -701,7 +701,7 @@ dependencies = [
701
701
 
702
702
  [[package]]
703
703
  name = "rust-embed"
704
- version = "0.5.1"
704
+ version = "0.5.2"
705
705
  dependencies = [
706
706
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
707
707
  "rocket 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rust-embed"
3
- version = "0.5.1"
3
+ version = "0.5.2"
4
4
  description = "Rust Marco which loads files into the rust binary at compile time during release and loads the file from the fs during dev"
5
5
  readme = "readme.md"
6
6
  documentation = "https://docs.rs/rust-embed"
examples/rouille.rs ADDED
@@ -0,0 +1,21 @@
1
+ #[macro_use]
2
+ extern crate rouille;
3
+
4
+ use rouille::Response;
5
+
6
+ // TBD
7
+ fn main() {
8
+ println!("Now listening on localhost:8000");
9
+ rouille::start_server("localhost:8000", move |request| {
10
+ {
11
+ let response = rouille::match_assets(&request, ".");
12
+ if response.is_success() {
13
+ return response;
14
+ }
15
+ }
16
+ Response::html(
17
+ "404 error. Try <a href=\"/README.md\"`>README.md</a> or \
18
+ <a href=\"/src/lib.rs\">src/lib.rs</a> for example.",
19
+ ).with_status_code(404)
20
+ });
21
+ }
readme.md CHANGED
@@ -19,7 +19,7 @@ these are macros which generate code at compile time for only files.
19
19
 
20
20
  ```
21
21
  [dependencies]
22
- rust-embed="0.5.1"
22
+ rust-embed="0.5.2"
23
23
  ```
24
24
 
25
25
  ## Documentation