yok

Crates.ioyok
lib.rsyok
version0.1.9
sourcesrc
created_at2023-10-04 18:43:20.310841
updated_at2023-11-19 10:41:17.975982
descriptionEmbed the contents of a directory in your binary
homepagehttps://dnrops.gitee.io
repositoryhttps://gitlab.com/andrew_ryan/yok
max_upload_size
id992800
size21,780
zinso (zinso)

documentation

https://docs.rs/yok

README

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
Commit count: 14

cargo fmt