#snappy #bindings

parity-snappy

Rust 对 snappy 压缩库的绑定

2 个版本

使用旧的 Rust 2015

0.1.0 2018年8月30日
0.1.0-beta.02018年8月29日

17#snappy

Download history 76/week @ 2024-03-11 104/week @ 2024-03-18 85/week @ 2024-03-25 140/week @ 2024-04-01 63/week @ 2024-04-08 93/week @ 2024-04-15 107/week @ 2024-04-22 81/week @ 2024-04-29 84/week @ 2024-05-06 83/week @ 2024-05-13 86/week @ 2024-05-20 78/week @ 2024-05-27 72/week @ 2024-06-03 47/week @ 2024-06-10 128/week @ 2024-06-17 99/week @ 2024-06-24

356 每月下载量

GPL-3.0 许可证

1MB
2.5K SLoC

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

parity-snappy

Build Status Build status

Rust 对 snappy 压缩库的绑定。

目前这个库使用 snappy v1.1.7。snappy 的源代码包含在 parity-snappy-sys 包中,因此无需预先安装 snappy,库将静态链接。

示例

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);

依赖