I have a binary file that's got LZSS compression against all of its data, and I'm trying to use the compression
crate to decode the data. I've got the compressed data loaded into a Vec<u8>
, but I haven't figured out how to use the decoder from the library. Here's the link to the decoder's source. I tried to pass a new instance of the decoder to the iterator's .decode()
method, but I keep getting the following compiler errors:
error[E0271]: type mismatch resolving `<compression::prelude::LzssDecoder as compression::prelude::Decoder>::Input == u8`
--> src\main.rs:104:5
|
104 | .decode(&mut LzssDecoder::new(0x1_0000))
| ^^^^^^ expected enum `compression::prelude::LzssCode`, found u8
|
= note: expected type `compression::prelude::LzssCode`
found type `u8`
error[E0599]: no method named `collect` found for type `compression::prelude::DecodeIterator<'_, std::iter::Cloned<std::slice::Iter<'_, u8>>, compression::prelude::LzssDecoder, std::iter::Cloned<std::slice::Iter<'_, u8>>>` in the current scope
--> src\main.rs:105:5
|
105 | .collect::<Result<Vec<_>, _>>()
| ^^^^^^^ method not found in `compression::prelude::DecodeIterator<'_, std::iter::Cloned<std::slice::Iter<'_, u8>>, compression::prelude::LzssDecoder, std::iter::Cloned<std::slice::Iter<'_, u8>>>`
A friend suggested that I needed to map over my data, and wrap each element in my vector in a LzssCode
enum, but I'm not sure how to easily determine which variant to use per byte.
Any ideas of what I should do?