8 releases

0.1.9 Nov 19, 2023
0.1.8 Oct 9, 2023

#927 in Development tools

MIT license

19KB
361 lines

yok

Crates.io Rust license

A crate for Embed the contents of a directory in your binary at compile time.

Getting Started

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

Set YOK_PATH env and run or default path is cuttent dir

# 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

No runtime deps