~repos /rust-embed

#rust#proc-macro#http

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.


051375a1 pyros2097

7 years ago
Update readme.md
Files changed (1) hide show
  1. readme.md +3 -1
readme.md CHANGED
@@ -23,7 +23,7 @@ rust-embed="0.3.0"
23
23
  ```
24
24
 
25
25
  ## Documentation
26
- It exposes a function to serve all files stored in your assets folder which is useful for webservers. So now you can statically compile all your assets i.e. your /static/ or /public/ folders into the rust executable and serve them during release and in development it will load the file from the file
26
+ The `embed!` macro takes a folder path and returns a function which allows you to get the file by passing the file path within the folder. So now you can statically compile all your assets i.e. your /static/ or /public/ folders into the rust executable and serve them during release and in development it will load the file from the file
27
27
  system so that it doesn't take to much time to compile;]
28
28
 
29
29
  ```rust
@@ -35,6 +35,8 @@ asset(path: String) -> Option<Vec<u8>>
35
35
  #[macro_use]
36
36
  extern crate rust_embed;
37
37
 
38
+ use rust_embed::*;
39
+
38
40
  fn main() {
39
41
  let asset = embed!("examples/public".to_owned());
40
42
  let index_html = asset("/index.html".to_owned()).unwrap();