~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. src/lib.rs +4 -4
src/lib.rs CHANGED
@@ -15,12 +15,12 @@ use quote::Tokens;
15
15
  #[cfg(debug_assertions)]
16
16
  fn generate_assets(ident: &syn::Ident, folder_path: String) -> quote::Tokens {
17
17
  quote!{
18
- use std::fs::File;
19
- use std::io::Read;
20
- use std::path::Path;
21
-
22
18
  impl #ident {
23
19
  pub fn get(file_path: &str) -> Option<Vec<u8>> {
20
+ use std::fs::File;
21
+ use std::io::Read;
22
+ use std::path::Path;
23
+
24
24
  let folder_path = #folder_path;
25
25
  let name = &format!("{}{}", folder_path, file_path);
26
26
  let path = &Path::new(name);