~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.


e65ae2ae pyros2097

7 years ago
Update README.md
Files changed (1) hide show
  1. README.md +8 -1
README.md CHANGED
@@ -82,4 +82,11 @@ Go Rusketeers!
82
82
  The power is yours!
83
83
 
84
84
  # TODO
85
- rewrite this to use compiler plugins and macro so that we can use that instead
85
+ Nice. People are still using this. I guess I will need to dig into implementing this in macro so that it automatically embeds these files in release mode and just loads the file on demand in debug mode.
86
+ something like this maybe,
87
+ ```rust
88
+ get_asset = !embed("src/public")
89
+ fn handle_index(req: Request, res: Response<Fresh>) {
90
+ res.send(get_asset(req.url.path).unwrap()).unwrap();
91
+ }
92
+ ```