I'm pleased to announce Iftree, a library to include many files in your Rust code.
"Yet another such library?!," you might be thinking, because there are already similar crates like
rust-embed. They embed files from directory trees.
I've worked on Iftree as I couldn't find a library that includes only files with a given filename extension. Since this project start, Iftree has developed into something more flexible.
Iftree's focus is on these aspects:
Path patterns are used to select files. For instance, you can include an entire folder, exclude hidden files, or filter files by filename extension. The patterns are in a familiar
Any data fields can be associated with selected files. Besides the file contents, this can be file metadata such as a media (MIME) type. In general, you can plug in your own macros to initialize this file data as you wish.
Data access is simple yet fast. You can access included file data either via an array. Or, if the file path is fixed at compile time, you can access the data of a file
base::path::to::MY_FILEvariables (in constant time).
While Iftree has defaults to address the most common use cases, I've tried not to bias the library too much. It's code generation process is customizable.
For a getting started guide, code examples, a comparison to related projects, etc., head over to Iftree's documentation.
This is an initial release, but the code has already seen a certain amount of smoothening. I'm ready to release a stable
1.0.0 soon if people find the API useful.
Thanks to the contributors of these crates that Iftree depends on:
May Iftree help you build self-contained binaries. I appreciate any feedback you have.
1.0.0 is available now.