PSeitz / lz4_flex

Fastest pure Rust implementation of LZ4 compression/decompression.
MIT License
441 stars 28 forks source link

It would be useful if `get_maximum_output_size()` were a const function #152

Closed hellertime closed 6 months ago

hellertime commented 6 months ago

It appears there is nothing that prevents get_maximum_output_size from being declared const, and if it were then it should be possible to use it in array initializers:

let buf = [u8; lz4_flex::block::compress::get_maximum_output_size(&input)];

PSeitz commented 6 months ago

Seems like a good idea if you know the size of your input, released with 0.11.3.

Stack allocation may be slower tough in some cases.