~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.
29ebae9a
—
BBaoVanC 2 years ago
Fix compilation with mime-guess feature disabled
- impl/src/lib.rs +5 -4
impl/src/lib.rs
CHANGED
|
@@ -174,12 +174,13 @@ fn embed_file(rel_path: &str, full_canonical_path: &str) -> TokenStream2 {
|
|
|
174
174
|
Some(last_modified) => quote! { Some(#last_modified) },
|
|
175
175
|
None => quote! { None },
|
|
176
176
|
};
|
|
177
|
-
|
|
177
|
+
#[cfg(feature = "mime-guess")]
|
|
178
|
+
let mimetype = {
|
|
178
179
|
let mt = file.metadata.mimetype().to_string();
|
|
179
|
-
quote! { #mt }
|
|
180
|
+
quote! { Some(#mt) }
|
|
180
|
-
} else {
|
|
181
|
-
quote! { None }
|
|
182
181
|
};
|
|
182
|
+
#[cfg(not(feature = "mime-guess"))]
|
|
183
|
+
let mimetype = quote! { None };
|
|
183
184
|
|
|
184
185
|
let embedding_code = if cfg!(feature = "compression") {
|
|
185
186
|
quote! {
|