#snappy #ffi #bindings #compression #native #native-bindings #tetsy-snappy

sys tetsy-snappy-sys

Native bindings to libsnappy

Show the crate…

1 unstable release

Uses old Rust 2015

0.1.2 Feb 17, 2021

#26 in #snappy

Download history 8/week @ 2024-02-19 18/week @ 2024-02-26 15/week @ 2024-03-04 21/week @ 2024-03-11 9/week @ 2024-03-18

64 downloads per month
Used in 43 crates (2 directly)

GPL-3.0 license

1MB
2.5K SLoC

C++ 2.5K SLoC // 0.2% comments Rust 61 SLoC // 0.2% comments

tetsy-snappy

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 tetsy-snappy-sys crate, so there's no need to pre-install snappy, and the library will be statically linked.

Example

use tetsy_snappy as snappy;

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

assert_eq!(decompressed, input);
use tetsy_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);

lib.rs:

Snappy compression bindings.

Dependencies