Expand description
Library to work with the 2 Byte zlib header, as defined in RFC 1950.
§Examples
use zlib_header::ZlibHeader;
let cm = 8;
let cinfo = 7;
let fdict = false;
let flevel = 2;
let header = ZlibHeader::new(cm, cinfo, fdict, flevel);
match header {
Ok(header) => {
println!("header is valid (strict): {}", header.is_valid_strict()); // header is valid (strict): true
},
Err(err) => eprintln!("Unable to initialize zlib header: {:?}", err)
}
use zlib_header::ZlibHeader;
let header = ZlibHeader::default();
println!("Display: {}", header); // Display: 789C
println!("Debug: {:?}", header); // Debug: ZlibHeader { DEFLATE | 32768 Bytes | default | Dictionary: false | valid }
let bytes = [0x78, 0x9C];
println!("header matches expected bytes: {}", header == bytes); // header matches expected bytes: true
Structs§
- 2 Byte header at the start of a zlib stream.
Enums§
- The error type when a value does not fit inside the possible range of a certain number of bits.