Skip to content

Drop unused Seek bounds from Decoder and Reader#687

Merged
197g merged 1 commit into
image-rs:masterfrom
ElliotSis:drop-seek-bounds
Jun 1, 2026
Merged

Drop unused Seek bounds from Decoder and Reader#687
197g merged 1 commit into
image-rs:masterfrom
ElliotSis:drop-seek-bounds

Conversation

@ElliotSis
Copy link
Copy Markdown
Contributor

Relax input requirements by removing the unused Seek bound from the Decoder and Reader APIs, as suggested in a review comment on PR #684.

Additionally:

  • Cleaned up unit tests and fuzz targets to remove mock Seek implementations.
  • Removed unused TryFrom import in src/encoder.rs to resolve compiler warning on CI.

Relax input requirements by removing the unused `Seek` bound from the `Decoder`
and `Reader` APIs, as suggested in a review comment on PR image-rs#684.

Additionally:
- Cleaned up unit tests and fuzz targets to remove mock `Seek` implementations.
- Removed unused `TryFrom` import in `src/encoder.rs` to resolve compiler warnings.
Copy link
Copy Markdown
Member

@197g 197g left a comment

Choose a reason for hiding this comment

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

Neat, this simplifying a lot of test shims is great news for consumers of the API. We previously had added Seek to existing functions out of consistency concerns. We're going to revise that here: we haven't seen much utilization of the bound during decoding. Reason mostly being that real images seldom include wasteful data by design, skipping over most auxiliary chunks by reading them is cheap enough.

Also since then I've myself become quite a lot more critical of IO trait bounds. They are viral and we can not express them as optional bounds. (The rather unsafe flexible-io experiment not-withstanding). In any case we can re-introduce optional Seek through a caller provided Option<Arc<dyn Fn(&mut R) -> &mut dyn Seek>>; seeking should not be as performance sensitive for inlining as Read so dyn trait seems fine. This is more flexible in any case.

@197g 197g merged commit 4ab5484 into image-rs:master Jun 1, 2026
24 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.

3 participants