I don't like the idea of having a separate set of free standing methods due to the number of constructor arguments and the complications in terms of adding new constructors (e.g. a GNU compress compatible option). Instead, I chose an interface where the simplest in-memory case now looks like so:
let data = Decoder::new(BitOrder::Msb, 9).decode(compressed)?;
This adds some special treatment for vectors (which previously were handled via io::Write and into_stream) but on the other hand this will allow for forward compatible, slight performance gain if we add decoding/encoding into uninitialized buffers in the future. It also adds a useful adapter for the common no_std, alloc combination.
Closes: #23 @s3bk
I don't like the idea of having a separate set of free standing methods due to the number of constructor arguments and the complications in terms of adding new constructors (e.g. a GNU compress compatible option). Instead, I chose an interface where the simplest in-memory case now looks like so:
This adds some special treatment for vectors (which previously were handled via
io::Write
andinto_stream
) but on the other hand this will allow for forward compatible, slight performance gain if we add decoding/encoding into uninitialized buffers in the future. It also adds a useful adapter for the commonno_std, alloc
combination.