#recursion #read #walk-dir #directory #create #compile-time #file-path

nightly include_dir_bytes

Read the directory recursively, and creates a HashMap with these contents at compile time with the file path as the key

3 unstable releases

Uses old Rust 2015

0.2.1 Oct 25, 2017
0.2.0 Oct 25, 2017
0.1.0 Oct 19, 2017

#19 in #walk-dir


Used in embed_staticfile

MIT license

6KB
84 lines

include_dir_bytes

Read the directory recursively, and creates a HashMap with these contents at compile time with the file path as the key.

Usage

Add this to your Cargo.toml:

[dependencies]
include_dir_bytes = "0.2"

and use it like this:

#![feature(plugin)]
#![plugin(include_dir_bytes)]

// ...

let file_map = include_dir!("path/to/dir");

Dependencies

~53KB