From cae983f2cc93258c69e0f28e149d5da7802bb464 Mon Sep 17 00:00:00 2001 From: Eric Kidd Date: Thu, 15 Sep 2016 10:29:29 -0400 Subject: Allow iteration over available file names Your example program included an unimplemented `entries` method. I chose not to implement `entries` because iterating over it would require decompressing any large files stored in the map. Instead, I've provided a `file_names` API that provides just the names of the files in the map, which the caller can look up (and potentially decompress) if they wish. I implemented a custom iterator wrapper to hide the implementation details from the caller. --- example/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'example/src') diff --git a/example/src/main.rs b/example/src/main.rs index 9ca782c..e1a4931 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -4,7 +4,10 @@ extern crate phf; include!(concat!(env!("OUT_DIR"), "/data.rs")); fn main() { - println!("{:?}", FILES.get("data/foo")) + println!("{:?}", FILES.get("data/foo")); + for name in FILES.file_names() { + println!("Found: {}", name); + } // for (k, v) in FILES.entries() { // println!("{}: {} bytes", k, v.len()); // } -- cgit v1.2.3