Skip to content

refactor!: shrink the buffer API and match Asio's iterator names - #479

Merged
sgerbino merged 1 commit into
cppalliance:developfrom
sgerbino:pr/buffer-refactor
Oct 30, 2026
Merged

sgerbino merged 1 commit into
cppalliance:developfrom
sgerbino:pr/buffer-refactor

Conversation

@sgerbino

@sgerbino sgerbino commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Shrinks the public buffer API and aligns the iterator names with Asio.

Removed

  • buffer_slice and slice_type. Neither capy nor corosio used them; the one caller in http now uses buffer_copy's at_most argument.
  • buffer_param and const_buffer_param. Their only user was http, which now keeps its own copy.

Made private

  • consuming_buffers moves to detail/consuming_buffers.hpp. The composed operations still use it, and Asio keeps its equivalent in detail too.

Renamed

Old New
begin / end buffer_sequence_begin / buffer_sequence_end (as in Asio)
front (front.hpp) buffers_front (buffers_front.hpp)
buffer_length buffers_count
buffer_empty buffers_empty

Added

  • buffers_iterator with buffers_begin / buffers_end: a random access iterator over the bytes of a buffer sequence, as Asio provides. It skips empty buffers, requires a single buffer or a common range, and rejects temporary sequences.

Docs, the Asio comparison, and tests are updated, with new unit tests for buffers_front and buffers_iterator.

Merge order: merge this first, then cppalliance/corosio#408 and cppalliance/http#296, which build against these names.

Remove buffer_slice and slice_type, which neither capy nor corosio
used; buffer_copy's at_most argument covers the one caller in http.
Remove buffer_param and const_buffer_param, whose only user is http,
which now keeps its own copy. Move consuming_buffers into detail. The
composed operations still use it, and Asio keeps its equivalent
private too.

Rename the buffer sequence functions. begin and end become
buffer_sequence_begin and buffer_sequence_end, matching Asio. front
becomes buffers_front, buffer_length becomes buffers_count, and
buffer_empty becomes buffers_empty.

Add buffers_iterator with buffers_begin and buffers_end, a random
access iterator over the bytes of a buffer sequence, as Asio
provides. It skips empty buffers, requires a single buffer or a
common range, and rejects temporary sequences.

Update the docs and the Asio comparison, and add unit tests for
buffers_front and buffers_iterator.
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://479.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-10-30 18:53:14 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://479.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://479.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://479.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-10-30 19:04:28 UTC

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (288067a) to head (11a606c).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #479      +/-   ##
===========================================
+ Coverage    98.48%   98.51%   +0.02%     
===========================================
  Files          137      137              
  Lines         7348     7484     +136     
===========================================
+ Hits          7237     7373     +136     
  Misses         111      111              
Flag Coverage Δ
linux 98.50% <ø> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
include/boost/capy/buffers.hpp 100.00% <100.00%> (ø)
include/boost/capy/buffers/buffer_copy.hpp 100.00% <100.00%> (ø)
include/boost/capy/buffers/buffers_front.hpp 100.00% <100.00%> (ø)
include/boost/capy/buffers/buffers_iterator.hpp 100.00% <100.00%> (ø)
include/boost/capy/detail/buffer_array.hpp 100.00% <100.00%> (ø)
include/boost/capy/detail/consuming_buffers.hpp 100.00% <100.00%> (ø)
include/boost/capy/detail/slice_of.hpp 100.00% <100.00%> (ø)
include/boost/capy/io/write_now.hpp 100.00% <ø> (ø)
include/boost/capy/read.hpp 100.00% <ø> (ø)
include/boost/capy/read_at_least.hpp 100.00% <ø> (ø)
... and 7 more

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 288067a...11a606c. Read the comment docs.

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

@sgerbino
sgerbino merged commit 367369f into cppalliance:develop Oct 30, 2026
41 checks passed
@sgerbino
sgerbino deleted the pr/buffer-refactor branch October 30, 2026 19:22
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants