ps-compress 0.1.0-17

Object wrapper around Zstandard compression
Documentation
  • Coverage
  • 35.29%
    6 out of 17 items documented0 out of 0 items with examples
  • Size
  • Source code size: 25.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 466.21 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 52s Average build duration of successful builds.
  • all releases: 1m 52s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • prokopschield

ps-compress

Deterministic Zstandard compression for small binary payloads.

This crate exposes a small API around zstd with a fixed compression policy (zstd level 2), suitable for use-cases where the same input must always compress to the same output bytes.

API

  • compress(data: &[u8]) -> Result<Buffer, CompressionError>
  • compress_into(data: &[u8], out_data: &mut [u8]) -> Result<usize, CompressionError>
  • decompress(data: &[u8]) -> Result<Buffer, DecompressionError>
  • decompress_bounded(data: &[u8], max_output_bytes: usize) -> Result<Buffer, DecompressionError>
  • decompress_into(data: &[u8], out_data: &mut [u8]) -> Result<usize, DecompressionError>

Example

use ps_compress::{compress, decompress};

let input = b"example payload";
let compressed = compress(input)?;
let decompressed = decompress(&compressed)?;

assert_eq!(decompressed.as_slice(), input);
# Ok::<(), Box<dyn std::error::Error>>(())

Determinism Notes

  • Compression parameters are fixed by this crate.
  • For strict cross-environment determinism, keep the crate dependency pinned so all environments use the same zstd implementation version.