From aea35fa7e1a3261e5e7a3e8daa999bed3dcd193f Mon Sep 17 00:00:00 2001 From: Till Höppner Date: Thu, 18 Feb 2016 18:53:30 +0100 Subject: Restructure, add API, add compression --- example/Cargo.toml | 17 +++++++++++++++++ example/build.rs | 10 ++++++++++ example/data/empty | 0 example/data/foo | 1 + example/data/inner/boom | 1 + example/src/main.rs | 11 +++++++++++ 6 files changed, 40 insertions(+) create mode 100644 example/Cargo.toml create mode 100644 example/build.rs create mode 100644 example/data/empty create mode 100644 example/data/foo create mode 100644 example/data/inner/boom create mode 100644 example/src/main.rs (limited to 'example') diff --git a/example/Cargo.toml b/example/Cargo.toml new file mode 100644 index 0000000..678f8fb --- /dev/null +++ b/example/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "foo" +version = "0.1.0" +authors = ["Till Höppner "] +build = "build.rs" +include = ["data", "data/*", "data/**"] +publish = false + +[dependencies] +phf = "0.7.12" +# includedir = "0.1.1" +includedir = { path = "../lib" } + +[build-dependencies] +# includedir = "0.1.1" +includedir = { path = "../lib" } +includedir_codegen = { path = "../codegen" } diff --git a/example/build.rs b/example/build.rs new file mode 100644 index 0000000..fb23001 --- /dev/null +++ b/example/build.rs @@ -0,0 +1,10 @@ +extern crate includedir_codegen; + +use includedir_codegen::Compression; + +fn main() { + includedir_codegen::start("FILES") + .dir("data", Compression::Gzip) + .build("data.rs") + .unwrap(); +} diff --git a/example/data/empty b/example/data/empty new file mode 100644 index 0000000..e69de29 diff --git a/example/data/foo b/example/data/foo new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/example/data/foo @@ -0,0 +1 @@ +foo diff --git a/example/data/inner/boom b/example/data/inner/boom new file mode 100644 index 0000000..9e2ba7e --- /dev/null +++ b/example/data/inner/boom @@ -0,0 +1 @@ +boom diff --git a/example/src/main.rs b/example/src/main.rs new file mode 100644 index 0000000..9ca782c --- /dev/null +++ b/example/src/main.rs @@ -0,0 +1,11 @@ +extern crate includedir; +extern crate phf; + +include!(concat!(env!("OUT_DIR"), "/data.rs")); + +fn main() { + println!("{:?}", FILES.get("data/foo")) + // for (k, v) in FILES.entries() { + // println!("{}: {} bytes", k, v.len()); + // } +} -- cgit v1.2.3