Closed CosmicHorrorDev closed 1 year ago
That's already possible with lz4_flex::block::compress_into
That only works if output
is already large enough to hold the result. A &mut Vec<u8>
can be resized larger
Yes you need to call buffer.resize(get_maximum_output_size(input), 0)
before calling compress_into
Ah I forgot that get_maximum_output_size()
is public. It's a bit clunky, but works so I'll go ahead and close
Currently the block (de)compression functions return a freshly allocated
Vec
per call. A common alternative when designing an API for putting data somewhere is to take aoutput: &mut Vec<u8>
so that you can reuse the same buffer over multiple callsThis would be a breaking change, but shouldn't affect performance in the existing benchmarks