~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.
a398d880
—
pyros2097 7 years ago
update readme
readme.md
CHANGED
|
@@ -13,7 +13,7 @@ This is not the same as std macros,
|
|
|
13
13
|
`include_bytes!`
|
|
14
14
|
`include_str!`
|
|
15
15
|
these are macros which generate code at compile time for only files.
|
|
16
|
-
`embed!("examples/public")` accepts folders and returns a function to get the contents using the file path
|
|
16
|
+
`embed!("examples/public/")` accepts folders and returns a function to get the contents using the file path
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -36,8 +36,8 @@ asset(path: String) -> Option<Vec<u8>>
|
|
|
36
36
|
extern crate rust_embed;
|
|
37
37
|
|
|
38
38
|
fn main() {
|
|
39
|
-
let asset = embed!("examples/public".to_owned());
|
|
39
|
+
let asset = embed!("examples/public/".to_owned());
|
|
40
|
-
let index_html = asset("
|
|
40
|
+
let index_html = asset("index.html".to_owned()).unwrap();
|
|
41
41
|
println!("{}", index_html);
|
|
42
42
|
}
|
|
43
43
|
```
|