~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.
af0ee5fe
—
pyros2097 7 years ago
Update readme.md
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
|
-
|
|
40
|
+
let index_html = asset("/index.html".to_owned()).unwrap();
|
|
34
|
-
|
|
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
|
|
50
|
+
debug: `cargo test --lib
|
|
45
51
|
|
|
46
|
-
release: `cargo test --lib --release
|
|
52
|
+
release: `cargo test --lib --release
|
|
47
53
|
|
|
48
54
|
Go Rusketeers!
|
|
49
55
|
The power is yours!
|