Crates.io | include-files |
lib.rs | include-files |
version | 0.1.2 |
source | src |
created_at | 2022-04-12 09:21:11.010895 |
updated_at | 2022-04-12 09:51:54.477906 |
description | Import files bytes into HashMap |
homepage | https://github.com/wyhaya/include-files |
repository | https://github.com/wyhaya/include-files.git |
max_upload_size | |
id | 566336 |
size | 5,648 |
Import files bytes into HashMap
Cargo.toml:
[dependencies]
once_cell = "1.10.0"
[build-dependencies]
include-files = "*"
build.rs:
fn main() {
let target = std::env::var("OUT_DIR").unwrap();
include_files::IncludeFiles::new("./assets", "png", target).build().unwrap();
}
src/example.rs:
// Import build.rs output file
include!(env!("INCLUDE_FILES_PATH"));
for item in INCLUDE_FILES {
println!("{:?}", item);
}