2 releases

0.1.4 Nov 19, 2021
0.1.3 Sep 3, 2019

#688 in Procedural macros

Download history 556/week @ 2022-08-13 1149/week @ 2022-08-20 933/week @ 2022-08-27 1337/week @ 2022-09-03 1443/week @ 2022-09-10 2171/week @ 2022-09-17 2585/week @ 2022-09-24 1954/week @ 2022-10-01 1853/week @ 2022-10-08 1755/week @ 2022-10-15 1866/week @ 2022-10-22 2149/week @ 2022-10-29 2060/week @ 2022-11-05 2121/week @ 2022-11-12 2341/week @ 2022-11-19 1977/week @ 2022-11-26

8,863 downloads per month
Used in 18 crates (via include-flate)




!CI crates.io docs.rs

A variant of include_bytes!/include_str! with compile-time deflation and runtime lazy inflation.


include_bytes!/include_str! are great for embedding resources into an executable/library without involving the complex logistics of maintaining an assets manager. However, they are copied as-is into the artifact, leading to unnecessarily large binary size. This library automatically compresses the resources and lazily decompresses them at runtime, allowing smaller binary sizes.

Nevertheless, this inevitably leads to wasting RAM to store both the compressed and decompressed data, which might be undesirable if the data are too large. An actual installer is still required if the binary involves too many resources that do not need to be kept in RAM all time.


This library compresses included data independently. It is usually more effective to compress the whole output binary together (e.g. distributing .exe.gz ) than to compress independently. In addition, compression algorithms usually produce smaller artifacts by processing the raw input together than by processing already-compressed output. #[cfg_attr] might come handy for conditionally using compression or direct data inclusion.


~21K SLoC