#snappy #parity

archived 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

#13 in #snappy

Download history 140/week @ 2023-10-26 153/week @ 2023-11-02 129/week @ 2023-11-09 115/week @ 2023-11-16 95/week @ 2023-11-23 78/week @ 2023-11-30 107/week @ 2023-12-07 129/week @ 2023-12-14 101/week @ 2023-12-21 60/week @ 2023-12-28 79/week @ 2024-01-04 131/week @ 2024-01-11 95/week @ 2024-01-18 72/week @ 2024-01-25 73/week @ 2024-02-01 76/week @ 2024-02-08

328 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