diff options
author | Till Höppner | 2016-02-18 19:12:44 +0100 |
---|---|---|
committer | Till Höppner | 2016-02-18 19:12:44 +0100 |
commit | d5fc8605e1ecb29db20a8739f770e4702f2575e6 (patch) | |
tree | 5c11d19e268581931db318bcdc6a3bdceebbf9dd /README.md | |
parent | cf5c804fb38df114c75b37878d5703d67402ef89 (diff) | |
download | includedir-d5fc8605e1ecb29db20a8739f770e4702f2575e6.tar.gz includedir-d5fc8605e1ecb29db20a8739f770e4702f2575e6.tar.xz includedir-d5fc8605e1ecb29db20a8739f770e4702f2575e6.zip |
Bump versions, update README examples
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -11,8 +11,8 @@ Include a directory in your Rust binary, e.g. static files for your web server o * [x] Automatically compile data into binary * [x] Use [rust-phf](https://github.com/sfackler/rust-phf) for efficient lookup -* [ ] Wrapping API around the phf map, to abstract away additional features -* [ ] Compression +* [x] Wrapping API around the phf map, to abstract away additional features +* [x] Compression, with optional crate "flate2" * [ ] Reading from source files for debug builds ## Example @@ -28,31 +28,36 @@ include = ["data"] [dependencies] phf = "0.7.12" +includedir = "0.2.0" [build-dependencies] -includedir = "0.1.1" +includedir_codegen = "0.2.0" ``` **build.rs** ```rust -extern crate includedir; +extern crate includedir_codegen; + +use includedir_codegen::Compression; fn main() { - includedir::build("data").unwrap(); + includedir_codegen::start("FILES") + .dir("data", Compression::Gzip) + .build("data.rs") + .unwrap(); } ``` **src/main.rs** ```rust +extern crate includedir; extern crate phf; -include!(concat!(env!("OUT_DIR"), "/dir_data.rs")); +include!(concat!(env!("OUT_DIR"), "/data.rs")); fn main() { - for (k, v) in FILES.entries() { - println!("{}: {} bytes", k, v.len()); - } + println!("{:?}", FILES.get("data/foo")) } ``` |