Skip to content

feat(bytesbuf): improve ergonomics of BytesView::as_read()#272

Merged
sandersaares merged 7 commits intomainfrom
feat/bytesbuf-bytesviewreader-bufread
Feb 20, 2026
Merged

feat(bytesbuf): improve ergonomics of BytesView::as_read()#272
sandersaares merged 7 commits intomainfrom
feat/bytesbuf-bytesviewreader-bufread

Conversation

@sandersaares
Copy link
Member

@sandersaares sandersaares commented Feb 18, 2026

Summary

This PR now simplifies the bytesbuf read path by removing the BytesViewReader wrapper and implementing std::io::Read and std::io::BufRead directly on BytesView.

What changed

bytesbuf functional changes

  • BytesViewReader was removed.
  • Read and BufRead are implemented directly for BytesView.
  • BytesView::reader() was removed.
  • The old read_adapter.rs module was renamed to view_read.rs to match its contents.
  • bytesbuf docs were updated to describe direct Read/BufRead support on BytesView.

Repository maintenance changes included in this branch

  • Ran just format (format-only updates across the repository).
  • Ran just readme and committed generated README updates.
  • Updated AGENTS.md with README/format guidance and a pre-commit checklist.

Validation

  • cargo clippy -p bytesbuf --all-features -- -D warnings
  • cargo test -p bytesbuf --all-features
    • 156 unit tests passed
    • 59 doc-tests passed

@sandersaares sandersaares marked this pull request as draft February 18, 2026 14:18
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (5cae290) to head (38a7472).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #272   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         141      141           
  Lines        8626     8626           
=======================================
  Hits         8626     8626           

☔ 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.

@sandersaares sandersaares force-pushed the feat/bytesbuf-bytesviewreader-bufread branch from 55449e8 to 41ddeb0 Compare February 18, 2026 14:27
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

⚠️ Breaking Changes Detected


--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/inherent_method_missing.ron

Failed in:
  BytesView::as_read, previously in file /home/runner/work/oxidizer/oxidizer/target/semver-checks/git-origin_main/72cc20df072573a1a83bb56bfb2859b7206b7666/crates/bytesbuf/src/view.rs:737

If the breaking changes are intentional then everything is fine - this message is merely informative.

Remember to apply a version number bump with the correct severity when publishing a version with breaking changes (1.x.x -> 2.x.x or 0.1.x -> 0.2.x).

- Make BytesViewReader a public named type (was pub(crate))
- Rename as_read() to reader() and return BytesViewReader<'_>
- Implement std::io::BufRead using first_slice()/advance()
- Update documentation to reflect BufRead support
- Add tests for BufRead (fill_buf, consume, read_line, empty view)

Closes #268

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandersaares sandersaares force-pushed the feat/bytesbuf-bytesviewreader-bufread branch from 41ddeb0 to 74be3f6 Compare February 18, 2026 14:32
@sandersaares sandersaares marked this pull request as ready for review February 18, 2026 14:52
@sandersaares sandersaares enabled auto-merge (squash) February 20, 2026 06:35
@sandersaares sandersaares merged commit 2a15324 into main Feb 20, 2026
27 checks passed
@sandersaares sandersaares deleted the feat/bytesbuf-bytesviewreader-bufread branch February 20, 2026 06:43
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

Comments