2021-06-05 21:36:04 -03:00
2021-06-05 21:36:04 -03:00
2020-06-17 15:22:58 -04:00
2021-06-05 21:36:04 -03:00
2016-02-16 19:06:31 +01:00
2018-12-11 21:40:19 +01:00
2016-03-09 19:53:00 +01:00
2021-06-05 21:36:04 -03:00
2016-02-19 14:52:41 +01:00

tauri_includedir

Deprecation notice

This crate was deprecated. It is now part of the tauri-codegen crate.

tauri-includedir

Include a directory in your Rust binary, e.g. static files for your web server or assets for your game.

Features

  • Automatically compile data into binary
  • Use rust-phf for efficient lookup
  • Wrapping API around the phf map, to abstract away additional features
  • Compression, with optional crate "flate2"
  • Reading from source files for debug builds

Example

Cargo.toml

[package]
name = "example"
version = "0.1.0"

build = "build.rs"
include = ["data"]

[dependencies]
phf = "0.8.0"
tauri_includedir = "0.5.0"

[build-dependencies]
tauri_includedir_codegen = "0.5.0"

build.rs

extern crate tauri_includedir_codegen;

use tauri_includedir_codegen::Compression;

fn main() {
    tauri_includedir_codegen::start("FILES")
        .dir("data", Compression::Gzip)
        .build("data.rs")
        .unwrap();
}

src/main.rs

extern crate tauri_includedir;
extern crate phf;

use std::env;

include!(concat!(env!("OUT_DIR"), "/data.rs"));

fn main() {
    FILES.set_passthrough(env::var_os("PASSTHROUGH").is_some());

    println!("{:?}", FILES.get("data/foo"))
}
Description
No description provided
Readme BSD-3-Clause 164 KiB
Languages
Rust 100%