1 unstable release
0.1.0 | Feb 17, 2023 |
---|
#710 in Compression
100 downloads per month
5KB
include_bytes_zstd!()
This library provides a macro to include a file with zstd compression.
This macro can be used like std::include_bytes!
, but the byte array is compressed by the zstd
crate. The included data will be decompressed by the ruzstd
crate in runtime and returned as a Vec<u8>
.
This macro performs the decompression each time it is called.
Examples
input.txt
:
This is a test.
Rust code:
let data = include_bytes_zstd::include_bytes_zstd!("test-resources/input.txt", 19);
assert_eq!(b"This is a test.\n", data.as_slice());
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
See the guidelines.
lib.rs
:
Includes a file with zstd compression.
This macro can be used like std::include_bytes
, but the byte array is compressed by the
zstd crate. The included data will be decompressed by the
ruzstd crate in runtime and returned as a Vec<u8>
.
This macro performs the decompression each time it is called.
Examples
input.txt
:
This is a test.
Rust code:
let data = include_bytes_zstd::include_bytes_zstd!("test-resources/input.txt", 19);
assert_eq!(b"This is a test.\n", data.as_slice());
Dependencies
~7MB
~137K SLoC