#snappy

parity-snappy

Rust bindings for the snappy compression library

2 releases

Uses old Rust 2015

0.1.0 Aug 30, 2018
0.1.0-beta.0 Aug 29, 2018

#23 in #snappy

Download history 215/week @ 2025-10-21 182/week @ 2025-10-28 236/week @ 2025-11-04 93/week @ 2025-11-11 392/week @ 2025-11-18 196/week @ 2025-11-25 186/week @ 2025-12-02 161/week @ 2025-12-09 88/week @ 2025-12-16 113/week @ 2025-12-23 117/week @ 2025-12-30 51/week @ 2026-01-06 116/week @ 2026-01-13 130/week @ 2026-01-20 97/week @ 2026-01-27 116/week @ 2026-02-03

459 downloads per month

GPL-3.0 license

1MB
2.5K SLoC

C++ 2.5K SLoC // 0.2% comments Rust 179 SLoC // 0.1% comments

parity-snappy

Build Status Build status

Rust bindings for the snappy compression library.

Currently this library uses snappy v1.1.7. The source for snappy is included in the parity-snappy-sys crate, so there's no need to pre-install snappy, and the library will be statically linked.

Example

use parity_snappy as snappy;

let input: Vec<u8> = ...;
let compressed = snappy::compress(&input);
let decompressed = snappy::decompress(&compressed);

assert_eq!(decompressed == input);
use parity_snappy as snappy;

let input: Vec<u8> = ...;
let mut compressed = Vec::with_capacity(snappy::max_compressed_len(input.len()));
let mut decompressed = Vec::with_capacity(input.len());

let len = snappy::compress_into(&input, &mut compressed);
let _ = snappy::decompress_into(&compressed[..len], &mut decompressed);

assert_eq!(decompressed == input);

Dependencies