Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@fintelia, can you PTAL?
I hope that these 4 commits are mostly non-controversial (or at least much less controversial than the incomplete follow-up here for experimenting with dynamic table sizes).
This PR is motivated by the desire to experiment (in a separate follow-up, just in my local repo for now) with moving
fn read_compressed
into an instance method ofCompressedBlock
(currently this is a method ofDecompressor
). And making it a method ofCompressedBlock
would help with supporting various table sizes by makingCompressedBlock
aconst
-generic, while exposingfn read_compressed
through adyn CompressedBlockHandler
trait.I wondered whether to also change
output_index
parameter offn read_compressed
to&mut usize
(and avoid returning the new/final value of this parameter). But I guess this would be unnecessary change = unnecessary risk (maybe this matters for performance). So let's just do the simplest thing for now?Similarily,
BitBuffer
could be more encapsulated (e.g. living in a separate submodule), but again - this is not needed and at this point would seem like an unnecessary complication.Note that in the 4th/final commit I can replace
break
withreturn Ok(...)
, because beforebreak
-ing we changeself.state
to something other thanState::CompressedData
- and the subsequentwhile
andif
check thatself.state == State::CompressedData
.