~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. impl/src/lib.rs +3 -3
impl/src/lib.rs CHANGED
@@ -140,12 +140,12 @@ fn embed_file(rel_path: &str, full_canonical_path: &str) -> TokenStream2 {
140
140
 
141
141
  let embedding_code = if cfg!(feature = "compression") {
142
142
  quote! {
143
- let bytes = &include_bytes!(#full_canonical_path)[..];
143
+ rust_embed::flate!(static FILE: [u8] from #full_canonical_path);
144
+ let bytes = &FILE[..];
144
145
  }
145
146
  } else {
146
147
  quote! {
147
- rust_embed::flate!(static FILE: [u8] from #full_canonical_path);
148
+ let bytes = &include_bytes!(#full_canonical_path)[..];
148
- let bytes = &FILE[..];
149
149
  }
150
150
  };
151
151