#byte #hash-map #import #include

include-files

Import files bytes into HashMap

0.1.2 Apr 12, 2022
0.1.1 Apr 12, 2022
0.1.0 Apr 12, 2022

#22 in #include

MIT license

5KB
56 lines

include-files

Import files bytes into HashMap

Usage

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:

Usage

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);
}

No runtime deps