~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 (1) hide show
  1. readme.md +12 -6
readme.md CHANGED
@@ -28,11 +28,17 @@ system so that it doesn't take to much time to compile;]
28
28
 
29
29
  ```rust
30
30
  asset(path: String) -> Option<Vec<u8>>
31
+ ```
32
+
33
+ ## Usage
34
+ ```rust
35
+ #[macro_use]
36
+ extern crate rust_embed;
31
37
 
38
+ fn main() {
32
- let asset = embed!("examples/public".to_owned());
39
+ let asset = embed!("examples/public".to_owned());
33
- match asset("/index.html".to_owned()) {
40
+ let index_html = asset("/index.html".to_owned()).unwrap();
34
- None => assert!(false, "index.html should exist"),
41
+ println!("{}", index_html);
35
- _ => assert!(true),
36
42
  }
37
43
  ```
38
44
 
@@ -41,9 +47,9 @@ To run the examples,
41
47
  `cargo run --example hyper`
42
48
 
43
49
  ## Testing
44
- debug: `cargo test --lib -- --nocapture`
50
+ debug: `cargo test --lib
45
51
 
46
- release: `cargo test --lib --release -- --nocapture`
52
+ release: `cargo test --lib --release
47
53
 
48
54
  Go Rusketeers!
49
55
  The power is yours!