Skip to content

WIP: less generic API#163

Draft
sftse wants to merge 3 commits into
bearcove:mainfrom
sftse:less-generics
Draft

WIP: less generic API#163
sftse wants to merge 3 commits into
bearcove:mainfrom
sftse:less-generics

Conversation

@sftse
Copy link
Copy Markdown
Contributor

@sftse sftse commented May 8, 2026

Not sure if this fact is known, but if we lean further into the concrete entry reader of #162 we get a much less generic API.

I think this makes the API simpler and more orthogonal with other features of Rust because the reader can still be attached with common iterator methods:

The old API for iterating over entries for example can be expressed as

let archive = reader.read_zip().unwrap();
archive.entries().map(|entr| reader.reader_at(entr)); // borrowing
// OR
archive.into_entries().map(move |entr| reader.reader_at(entr)); // can be 'static, using PR #158

The only downsides I can think of is that in the common case, for example reading from File there is a chance that a user misconstrues the reader on another File, as it's not passed down internally. Such a mistake would appear to be reasonably easy to find.

Feel free to close if not interested.

Would be an alternative to #157

@sftse sftse marked this pull request as draft May 12, 2026 15:10
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 51.35135% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.50%. Comparing base (4c0ff8d) to head (dcad1cf).

Files with missing lines Patch % Lines
rc-zip-sync/src/read_zip.rs 48.14% 14 Missing ⚠️
rc-zip-cli/src/main.rs 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #163      +/-   ##
==========================================
- Coverage   77.97%   77.50%   -0.48%     
==========================================
  Files          27       27              
  Lines        2711     2689      -22     
  Branches      134      134              
==========================================
- Hits         2114     2084      -30     
- Misses        528      536       +8     
  Partials       69       69              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant