PSeitz / lz4_flex

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

`FrameInfo` builder #99

Closed CosmicHorrorDev closed 1 year ago

CosmicHorrorDev commented 1 year ago

This adds in fluent API style contruction for FrameInfo. Now you can do

let info = FrameInfo::new()
    .block_size(BlockSize::Max1MB)
    .content_checksum(true);

IMO it reads better, but it also has the benefit of making it easier to see when the returned FrameInfo is unused through avoiding mutability. E.g this wouldn't get picked up as unused

let mut info = FrameInfo::new();
info.content_checksum = true;
codecov[bot] commented 1 year ago

Codecov Report

Merging #99 (a8baba2) into main (be2ea76) will decrease coverage by 0.99%. The diff coverage is 11.53%.

@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
- Coverage   89.39%   88.41%   -0.99%     
==========================================
  Files          11       11              
  Lines        2179     2192      +13     
==========================================
- Hits         1948     1938      -10     
- Misses        231      254      +23     
Impacted Files Coverage Δ
src/frame/header.rs 79.74% <11.53%> (-9.10%) :arrow_down:

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

PSeitz commented 1 year ago

Thanks!