显示包…

1 个不稳定版本

使用旧的 Rust 2015

0.1.2 2021 年 2 月 17 日

#27 in #snappy


用于 43 个包 (2 直接)

GPL-3.0 许可证

1MB
2.5K SLoC

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

tetsy-snappy

Build Status

Rust 对 snappy 压缩库的绑定。

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

示例

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 压缩绑定。

依赖