~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.
c3fb0c4e
—
mbme 4 years ago
apply changes suggested in PR
- impl/src/lib.rs +5 -10
- utils/src/lib.rs +1 -1
impl/src/lib.rs
CHANGED
|
@@ -211,16 +211,11 @@ fn impl_rust_embed(ast: &syn::DeriveInput) -> TokenStream2 {
|
|
|
211
211
|
_ => panic!("RustEmbed can only be derived for unit structs"),
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
let folder_path: String = {
|
|
215
|
-
|
|
214
|
+
let mut folder_paths = find_attribute_values(ast, "folder");
|
|
216
|
-
|
|
217
|
-
match (it.next(), it.next()) {
|
|
218
|
-
|
|
215
|
+
if folder_paths.len() != 1 {
|
|
219
|
-
_ => {
|
|
220
|
-
|
|
216
|
+
panic!("#[derive(RustEmbed)] must contain one attribute like this #[folder = \"examples/public/\"]");
|
|
221
|
-
|
|
217
|
+
}
|
|
222
|
-
}
|
|
223
|
-
|
|
218
|
+
let folder_path = folder_paths.remove(0);
|
|
224
219
|
|
|
225
220
|
let prefix = find_attribute_values(ast, "prefix").into_iter().next();
|
|
226
221
|
let includes = find_attribute_values(ast, "include");
|
utils/src/lib.rs
CHANGED
|
@@ -14,7 +14,7 @@ pub struct FileEntry {
|
|
|
14
14
|
|
|
15
15
|
#[cfg(not(feature = "include-exclude"))]
|
|
16
16
|
pub fn is_path_included(_path: &str, _includes: &[&str], _excludes: &[&str]) -> bool {
|
|
17
|
-
|
|
17
|
+
true
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
#[cfg(feature = "include-exclude")]
|