pub struct Decoder<'a, R: Read> { /* private fields */ }
Expand description

Specify the decoding settings, such as logging, input, and output.

To create a new Decoder, use for_reader(), for_bytes(), or for_file(). Then, change any of the decoder settings. Finally, decode the input data with decode.

let original = b"ABBACABBACD";
let compressed = Encoder::for_bytes(original)
    .encode_to_vec()
    .unwrap();
let decompressed = Decoder::for_bytes(&compressed)
    .decode()
    .unwrap();
assert_eq!(&original[..], decompressed);

You can use a Decoder to get the VpkHeader with header() or TreeInfo with trees():

let mut decoder = Decoder::for_bytes(&compressed);
let size = decoder.header().unwrap().size as usize;
assert_eq!(size, original.len());

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.