include_dir icon indicating copy to clipboard operation
include_dir copied to clipboard

Add a feature to compress input files and then lazily decompress it

Open LordRatte opened this issue 3 years ago • 1 comments

A suggested solution for #14

LordRatte avatar May 05 '22 08:05 LordRatte

To visualise how it works, let's take an example of the generated, intermediate code.

...

static PROJECT_DIR: Dir =
    include_dir::Dir::new("",
        &[include_dir::DirEntry::File(include_dir::File::new("a",
                            b"12345678910\n12345678910\n12345678910\n12345678910\n12345678910\n12345678910\n12345678910\n12345678910\n12345678910\n12345678910\n"))]);

fn main() {
    PROJECT_DIR.extract(Path::new("./o")).unwrap();
}

Now becomes the following with the feature turned on

...

static PROJECT_DIR: Dir = include_dir::Dir::new(
    "",
    &[include_dir::DirEntry::File(include_dir::File::new(
        "a",
        b"\xcf12345678910\n\x0c\x00Y\x00",
    ))],
);

fn main() {
    PROJECT_DIR.extract(Path::new("./o")).unwrap();
}

LordRatte avatar May 05 '22 08:05 LordRatte