Rust

snappy

Module

Snappy, a port of Google's C++ snappy 1.2.1.

Contents

use utopia_compression::Snappy;
Rust
pub struct Snappy

Snappy raw format: the uncompressed length as a varint, then literals and copies.

Rust
use utopia_compression::{Algorithm, Snappy};

let snappy = Snappy::new();
let body = snappy.compress(b"This is a demo string")?;
assert_eq!(body.len(), 23);
assert_eq!(snappy.decompress(&body)?, b"This is a demo string");