Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/compress/zlib"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
checksum |
std/checksum |
zlib.dodo |
deflate |
std/compress/deflate |
zlib.dodo |
max_encoded_len
Function · Source
An output length that every encode level is guaranteed to fit.
pub fn max_encoded_len(input_len: usize) -> usize
decode
Function · Source
Decodes one zlib stream; bytes after its trailer are left unconsumed. On error the output contents are unspecified.
pub fn decode(input: &[u8], output: &mut[u8]) -> deflate.DecodeResult!deflate.Error
encode
Function · Source
Compresses input into one zlib stream at level 0 through 9; see deflate.encode. max_encoded_len(input.len) bytes always suffice.
pub fn encode(input: &[u8], output: &mut[u8], level: usize) -> usize!deflate.Error
encode_with_workspace
Function · Source
pub fn encode_with_workspace(input: &[u8], output: &mut[u8], level: usize, words: &mut[u32]) -> usize!deflate.Error
Decoder
Struct · Source
Incremental zlib decoder for one stream. It reads nothing past the trailer. Errors are final; reset() starts a new stream.
pub struct Decoder {
// Private implementation fields omitted.
}
Decoder.new
Function · Source
pub fn new() -> Decoder
Decoder.reset
Function · Source
pub fn reset(&mut self)
Decoder.is_done
Function · Source
pub fn is_done(&self) -> bool
Decoder.process
Function · Source
pub fn process(&mut self, input: &[u8], output: &mut[u8]) -> deflate.Progress!deflate.Error
Encoder
Struct · Source
Incremental zlib compressor; see deflate.Encoder for the process contract.
pub struct Encoder {
// Private implementation fields omitted.
}
Encoder.new
Function · Source
Borrows storage as deflate.Encoder.new does.
pub fn new(level: usize, buffer: &mut[u8], words: &mut[u32]) -> Encoder!deflate.Error from(buffer, words)
Encoder.reset
Function · Source
pub fn reset(&mut self)
Encoder.process
Function · Source
pub fn process(&mut self, input: &[u8], output: &mut[u8], finish: bool) -> deflate.Progress