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


file:

tests/metadata_only.rs

use rust_embed::{Embed, EmbeddedFile};
#[derive(Embed)]
#[folder = "examples/public/"]
#[metadata_only = true]
struct Asset;
#[test]
fn file_is_empty() {
let index_file: EmbeddedFile = Asset::get("index.html").expect("index.html exists");
assert_eq!(index_file.data.len(), 0);
}