Crates.io | yok |
lib.rs | yok |
version | 0.1.9 |
source | src |
created_at | 2023-10-04 18:43:20.310841 |
updated_at | 2023-11-19 10:41:17.975982 |
description | Embed the contents of a directory in your binary |
homepage | https://dnrops.gitee.io |
repository | https://gitlab.com/andrew_ryan/yok |
max_upload_size | |
id | 992800 |
size | 21,780 |
A crate for Embed the contents of a directory in your binary at compile time.
cargo add yok
#[allow(warnings)]
fn main() {
use yok::{Dir, Bytes,include_dir};
const DATA: &[u8] = include_dir();
let dir: Dir = DATA.into_dir();
for entry in &dir.data {
if entry.is_file {
println!("{}", String::from_utf8_lossy(&entry.contents));
} else if entry.is_dir {
println!("{}", entry.path);
}
}
dir.extract("./path");
}
# linux,macos
export YOK_PATH="/home/andrew/code/gitlab/test_code/"
# windows cmd
set YOK_PATH="C:\path\to\your\directory"
# windows powershell
$env:YOK_PATH = "C:\path\to\your\directory"
cargo clean
cargo r