Skip to content

add Deflate from config constructor - #556

Merged
folkertdev merged 2 commits into
trifectatechfoundation:mainfrom
austin-weeks:main
Aug 14, 2026
Merged

add Deflate from config constructor#556
folkertdev merged 2 commits into
trifectatechfoundation:mainfrom
austin-weeks:main

Conversation

@austin-weeks

@austin-weeks austin-weeks commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Hello! This diff exposes a new constructor on the Deflate struct allowing users to create an instance directly with a set DeflateConfig.

I found myself needing this, as I'd like to use Deflate with a specific mem_level set, which I'm unable to do with the current API.

@folkertdev folkertdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

Because this is public API and user-facing I'm especially nit-picky here

Comment thread zlib-rs/src/stable.rs Outdated
Comment on lines 308 to 312
@@ -312,6 +312,20 @@ impl Deflate {
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this call Self::new_with_config instead?

Comment thread zlib-rs/src/stable.rs Outdated
/// tweaking `mem_level` or `strategy` is desired.
///
/// This allocates, so should be done with care.
pub fn new_from_config(config: DeflateConfig) -> Self {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn new_from_config(config: DeflateConfig) -> Self {
pub fn new_with_config(config: DeflateConfig) -> Self {

Comment thread zlib-rs/src/stable.rs Outdated
}
}

/// Create a new instance from the provided `DeflateConfig`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Create a new instance from the provided `DeflateConfig`.
/// Create a new instance from the provided [`DeflateConfig`].

that'll make it clickable

Comment thread zlib-rs/src/stable.rs Outdated
Comment on lines +317 to +318
/// In most cases it is recommended to use the standard `Deflate::new` constructor unless
/// tweaking `mem_level` or `strategy` is desired.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// In most cases it is recommended to use the standard `Deflate::new` constructor unless
/// tweaking `mem_level` or `strategy` is desired.
/// In most cases it is recommended to use the standard [`Deflate::new`] constructor unless
/// tweaking `mem_level` or `strategy` is desired.

@austin-weeks

Copy link
Copy Markdown
Contributor Author

Nice, thanks!

Because this is public API and user-facing I'm especially nit-picky here

Totally understand - addressed everything, thanks!

@austin-weeks

Copy link
Copy Markdown
Contributor Author

Hey @folkertdev, would you mind re-reviewing this? 🙏

@folkertdev

Copy link
Copy Markdown
Member

Right, can you rebase and force push? (I had to fix CI)

@austin-weeks

Copy link
Copy Markdown
Contributor Author

@folkertdev done!

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
fuzz-compress ?
fuzz-decompress ?
test-aarch64-apple-darwin 90.24% <100.00%> (+0.03%) ⬆️
test-aarch64-unknown-linux-gnu 85.09% <100.00%> (+<0.01%) ⬆️
test-i686-unknown-linux-gnu 84.71% <100.00%> (-0.02%) ⬇️
test-x86_64-apple-darwin 87.72% <100.00%> (+<0.01%) ⬆️
test-x86_64-unknown-linux-gnu 93.42% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
zlib-rs/src/stable.rs 72.30% <100.00%> (+0.43%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@folkertdev
folkertdev merged commit aeded1c into trifectatechfoundation:main Aug 14, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants