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


110d412e Peter John

3 years ago
Merge pull request #191 from pyrossh/tweak/fail-if-include-exclude-not-enabled
Files changed (1) hide show
  1. impl/src/lib.rs +5 -0
impl/src/lib.rs CHANGED
@@ -231,6 +231,11 @@ fn impl_rust_embed(ast: &syn::DeriveInput) -> TokenStream2 {
231
231
  let includes = find_attribute_values(ast, "include");
232
232
  let excludes = find_attribute_values(ast, "exclude");
233
233
 
234
+ #[cfg(not(feature = "include-exclude"))]
235
+ if !includes.is_empty() || !excludes.is_empty() {
236
+ panic!("Please turn on the `include-exclude` feature to use the `include` and `exclude` attributes")
237
+ }
238
+
234
239
  #[cfg(feature = "interpolate-folder-path")]
235
240
  let folder_path = shellexpand::full(&folder_path).unwrap().to_string();
236
241