Skip to content

Migrate burl example to capy post-#262 buffer API#161

Merged
mvandeberg merged 1 commit into
cppalliance:developfrom
mvandeberg:pr/capy-262-migration
May 15, 2026
Merged

Migrate burl example to capy post-#262 buffer API#161
mvandeberg merged 1 commit into
cppalliance:developfrom
mvandeberg:pr/capy-262-migration

Conversation

@mvandeberg
Copy link
Copy Markdown
Contributor

cppalliance/capy#262 removes the slice_of<> class template and the slice CPOs (prefix, etc.). The burl example's any_stream type-erasure used both:

  • The virtual async_write_some/async_read_some signatures took capy::slice_of<boost::span<capy::const_buffer const>>/mutable parameters.
  • The outer rate-limited templates used capy::prefix(buffers, n) to limit each underlying call to the remaining byte budget.

Migration:

  • Change the virtual signatures to take the underlying boost::span<X const> directly, plus a std::size_t max_bytes parameter carrying the byte budget. The implementation wraps the span in capy::buffer_slice(span, 0, max_bytes) and forwards s.data() to the inner stream.
  • The outer templates pass buffers, wr_remain_ / buffers, rd_remain_ directly through the virtual; the slicing happens on the receiving side.
  • Replace the <boost/capy/buffers/slice.hpp> include with <boost/capy/buffers/buffer_slice.hpp>.

The burl example remains disabled in CMake (pre-existing — its asio dependency requires a boost::asio::any_completion_handler.hpp that isn't in the pinned asio build). This migration keeps the source in sync with the new capy API so it can be re-enabled when the asio dependency is resolved.

cppalliance/capy#262 removes the `slice_of<>` class template and the
slice CPOs (`prefix`, etc.). The `burl` example's `any_stream`
type-erasure used both:

- The virtual `async_write_some`/`async_read_some` signatures took
  `capy::slice_of<boost::span<capy::const_buffer const>>`/`mutable`
  parameters.
- The outer rate-limited templates used `capy::prefix(buffers, n)`
  to limit each underlying call to the remaining byte budget.

Migration:

- Change the virtual signatures to take the underlying
  `boost::span<X const>` directly, plus a `std::size_t max_bytes`
  parameter carrying the byte budget. The implementation wraps the
  span in `capy::buffer_slice(span, 0, max_bytes)` and forwards
  `s.data()` to the inner stream.
- The outer templates pass `buffers, wr_remain_` / `buffers,
  rd_remain_` directly through the virtual; the slicing happens
  on the receiving side.
- Replace the `<boost/capy/buffers/slice.hpp>` include with
  `<boost/capy/buffers/buffer_slice.hpp>`.

The `burl` example remains disabled in CMake (pre-existing — its
asio dependency requires a `boost::asio::any_completion_handler.hpp`
that isn't in the pinned asio build). This migration keeps the
source in sync with the new capy API so it can be re-enabled when
the asio dependency is resolved.
@mvandeberg mvandeberg merged commit fb0a9c8 into cppalliance:develop May 15, 2026
2 of 49 checks passed
@mvandeberg mvandeberg deleted the pr/capy-262-migration branch May 15, 2026 21:34
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