Module libflate::deflate

source ·
Expand description

The encoder and decoder of the DEFLATE format and algorithm.

The DEFLATE is defined in RFC-1951.

Examples

use std::io::{self, Read};
use libflate::deflate::{Encoder, Decoder};

// Encoding
let mut encoder = Encoder::new(Vec::new());
io::copy(&mut &b"Hello World!"[..], &mut encoder).unwrap();
let encoded_data = encoder.finish().into_result().unwrap();

// Decoding
let mut decoder = Decoder::new(&encoded_data[..]);
let mut decoded_data = Vec::new();
decoder.read_to_end(&mut decoded_data).unwrap();

assert_eq!(decoded_data, b"Hello World!");

Modules

decode 🔒
encode 🔒
symbol 🔒

Structs

DEFLATE decoder.
Options for a DEFLATE encoder.
DEFLATE encoder.

Enums

BlockType 🔒

Constants

The default size of a DEFLATE block.