rust-embed v8.11.0
git clone https://git.pyrossh.dev/rust-embed
rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
c952c5a
— Mcat12
2018-05-16T16:54:27-04:00
Move the debug mode use statments into `get`
- src/lib.rs +4 -4
src/lib.rs
CHANGED
|
@@ -15,12 +15,12 @@ use quote::Tokens;
|
|
|
15
15
|
#[cfg(debug_assertions)]
|
|
16
16
|
fn generate_assets(ident: &syn::Ident, folder_path: String) -> quote::Tokens {
|
|
17
17
|
quote!{
|
|
18
|
-
use std::fs::File;
|
|
19
|
-
use std::io::Read;
|
|
20
|
-
use std::path::Path;
|
|
21
|
-
|
|
22
18
|
impl #ident {
|
|
23
19
|
pub fn get(file_path: &str) -> Option<Vec<u8>> {
|
|
20
|
+
use std::fs::File;
|
|
21
|
+
use std::io::Read;
|
|
22
|
+
use std::path::Path;
|
|
23
|
+
|
|
24
24
|
let folder_path = #folder_path;
|
|
25
25
|
let name = &format!("{}{}", folder_path, file_path);
|
|
26
26
|
let path = &Path::new(name);
|