0.1.2 |
|
---|---|
0.1.1 |
|
0.1.0 |
|
#123 in #import
5KB
56 行
include-files
将文件字节导入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);
}
lib.rs
:
用法
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);
}