# include_walk
[](https://crates.io/crates/include_walk)
[](https://github.com/vincent-herlemont/include_walk/actions/)
Include content files directory recursively using `include_str!` or `include_bytes!`.
It generate an output rust file with a method that return an [HashMap](https://doc.rust-lang.org/std/collections/struct.HashMap.html) composed like this : __<path file `&'static str`, content file `&'static str`>__
# Installation
Add `include_walk` to the build-dependencies in `./Cargo.toml`.
```toml
[build-dependencies]
include_walk = "0.2.0"
```
Create a builder file `./build.rs`. Below, there is a lite example : that import recursively all file present in `./src/assets/` and
generate a file import `./src/assets.rs`.
By defaults, files are imported as `&'static str` using `include_str!`.
```rust
// ./build.rs
fn main() {
include_walk::from("./src/assets/").to("./src/assets.rs");
}
```
### Use Cases
Retrieve all content files. For more detail see your generated file :
`./src/assets.rs` in that example.
```rust
// ./src/main.rs
mod assets;
fn main() {
let assets = assets::getAll();
let content = assets.get("assets/relative/path/to/files...").unwrap();
println!("{}", content);
}
```
# Methods
| ::from(path) | YES | - | Specified the directory path to import |
| .to(path) | YES | - | The path of generated module. |
| .filter(|path_file| -> bool) | NO | deactivate | Filter function that take a callback who can provide an `path_file` [PathBuf](https://doc.rust-lang.org/std/path/struct.PathBuf.html) argument and return `bool` : `true` for include and `false` for exclude file. |
| .bytes() | NO | deactivated | include with `include_bytes!` |
| .str() | NO | activated | include with `include_str!` |