~repos /rust-embed

#rust#proc-macro#http

git clone https://pyrossh.dev/repos/rust-embed.git
Discussions: https://groups.google.com/g/rust-embed-devs

rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.


Files changed (2) hide show
  1. impl/src/lib.rs +1 -4
  2. utils/src/lib.rs +1 -1
impl/src/lib.rs CHANGED
@@ -25,10 +25,7 @@ fn embedded(
25
25
  let includes: Vec<&str> = includes.iter().map(AsRef::as_ref).collect();
26
26
  let excludes: Vec<&str> = excludes.iter().map(AsRef::as_ref).collect();
27
27
  for rust_embed_utils::FileEntry { rel_path, full_canonical_path } in rust_embed_utils::get_files(absolute_folder_path.clone(), &includes, &excludes) {
28
- match_values.insert(
29
- rel_path.clone(),
30
- embed_file(relative_folder_path.clone(), ident, &rel_path, &full_canonical_path)?,
28
+ match_values.insert(rel_path.clone(), embed_file(relative_folder_path, ident, &rel_path, &full_canonical_path)?);
31
- );
32
29
 
33
30
  list_values.push(if let Some(prefix) = prefix {
34
31
  format!("{}{}", prefix, rel_path)
utils/src/lib.rs CHANGED
@@ -141,7 +141,7 @@ pub fn read_file_from_fs(file_path: &Path) -> io::Result<EmbeddedFile> {
141
141
  let hash: [u8; 32] = hasher.finalize().into();
142
142
 
143
143
  let source_date_epoch = match std::env::var("SOURCE_DATE_EPOCH") {
144
- Ok(value) => value.parse::<u64>().map_or(None, |v| Some(v)),
144
+ Ok(value) => value.parse::<u64>().ok(),
145
145
  Err(_) => None,
146
146
  };
147
147