Instead of separate decode_bytes_into for pixels, and a different event for LZW, it uses an OutputBuffer that handles both slices and Vec (for appending LZW, and only LZW, because Weezl decoder doesn't support writing to a MaybeUninit, so I did not add Vec-append-based optimization for pixel decoding).
I've also added an if false { return … } block for checking that the lifetimes of the events and buffers are correct, because the other return mem::transmute didn't check them, and was dangerous.
Instead of separate
decode_bytes_into
for pixels, and a different event for LZW, it uses anOutputBuffer
that handles both slices andVec
(for appending LZW, and only LZW, because Weezl decoder doesn't support writing to aMaybeUninit
, so I did not add Vec-append-based optimization for pixel decoding).I've also added an
if false { return … }
block for checking that the lifetimes of the events and buffers are correct, because the otherreturn mem::transmute
didn't check them, and was dangerous.