include-zstd
English | 简体中文
include-zstd is a Rust macro library that compresses text or binary data at compile time and decompresses it on demand at runtime, returning either &'static str or &'static [u8].
Usage
1. Add dependency
Run:
cargo add include-zstd
2. Common macros
include_zstd::str!("..."): inline string, returns&'static strinclude_zstd::bytes!(b"..."): inline byte string, returns&'static [u8]include_zstd::file_str!("path"): reads a file and returns&'static stras UTF-8include_zstd::file_bytes!("path"): reads a file and returns&'static [u8]
Path resolution for
include_zstd::file_str!/include_zstd::file_bytes!is the same asinclude_str!/include_bytes!: relative paths are resolved from the directory of the source file where the macro is invoked.
4. Example