enum Wrapper<'a, W: Write> {
    Chunk(ChunkWriter<'a, W>),
    Zlib(ZlibEncoder<ChunkWriter<'a, W>>),
    Unrecoverable,
    None,
}Expand description
This enum is used to be allow the StreamWriter to keep
its inner ChunkWriter without wrapping it inside a
ZlibEncoder. This is used in the case that between the
change of state that happens when the last write of a frame
is performed an error occurs, which obviously has to be returned.
This creates the problem of where to store the writer before
exiting the function, and this is where Wrapper comes in.
Unfortunately the ZlibWriter can’t be used because on the
write following the error, finish would be called and that
would write some data even if 0 bytes where compressed.
If the finish function fails then there is nothing much to
do as the ChunkWriter would get lost so the Unrecoverable
variant is used to signal that.
Variants§
Chunk(ChunkWriter<'a, W>)
Zlib(ZlibEncoder<ChunkWriter<'a, W>>)
Unrecoverable
None
This is used in-between, should never be matched