https://github.com/olback/include-dir-rs
https://github.com/olback/include-dir-rs
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/olback/include-dir-rs
- Owner: olback
- Created: 2022-03-27T02:04:18.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T02:17:17.000Z (about 4 years ago)
- Last Synced: 2025-02-08T12:31:25.287Z (about 1 year ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# include-dir-rs
[](https://circleci.com/gh/olback/include-dir-rs/tree/master)
build.rs example
```rust
fn main() {
include_dir::include_dir(
"my_dir", // Dir to include
"out_file.rs", // Output file
VarKind::Both, // What data should be included?
"VAR_NAME",
true, // Recursive?
)
.unwrap();
}
```
Assuming the following directory structure, the build script would produce the following:
```
my_dir
├── file1.txt
└── sub
└── file2.txt
```
```rust
const VAR_NAME: &[(&str, &[u8])] = &[
("my_dir/file1.txt", include_bytes!("my_dir/file1.txt")),
("my_dir/sub/file2.txt", include_bytes!("my_dir/sub/file2.txt")),
];
```