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


2f877845 Christoph Taucher

2 years ago
change const to upper case
Files changed (1) hide show
  1. impl/src/lib.rs +4 -4
impl/src/lib.rs CHANGED
@@ -97,11 +97,11 @@ fn dynamic(ident: &syn::Ident, folder_path: String, prefix: Option<&str>, includ
97
97
  };
98
98
 
99
99
  let declare_includes = quote! {
100
- const includes: &[&str] = &[#(#includes),*];
100
+ const INCLUDES: &[&str] = &[#(#includes),*];
101
101
  };
102
102
 
103
103
  let declare_excludes = quote! {
104
- const excludes: &[&str] = &[#(#excludes),*];
104
+ const EXCLUDES: &[&str] = &[#(#excludes),*];
105
105
  };
106
106
 
107
107
  let canonical_folder_path = Path::new(&folder_path).canonicalize().expect("folder path must resolve to an absolute path");
@@ -127,7 +127,7 @@ fn dynamic(ident: &syn::Ident, folder_path: String, prefix: Option<&str>, includ
127
127
  return None;
128
128
  }
129
129
 
130
- if rust_embed::utils::is_path_included(&rel_file_path, includes, excludes) {
130
+ if rust_embed::utils::is_path_included(&rel_file_path, INCLUDES, EXCLUDES) {
131
131
  rust_embed::utils::read_file_from_fs(&canonical_file_path).ok()
132
132
  } else {
133
133
  None
@@ -141,7 +141,7 @@ fn dynamic(ident: &syn::Ident, folder_path: String, prefix: Option<&str>, includ
141
141
  #declare_includes
142
142
  #declare_excludes
143
143
 
144
- rust_embed::utils::get_files(String::from(#folder_path), includes, excludes)
144
+ rust_embed::utils::get_files(String::from(#folder_path), INCLUDES, EXCLUDES)
145
145
  .map(|e| #map_iter)
146
146
  }
147
147
  }