feat: make IoAwaitables composable as std::execution senders#371
Merged
Conversation
Extend the awaitable-sender example so capy I/O awaitables participate in C++26 sender pipelines, written against std::execution names only (a bundled pre-standard implementation fills in through a single alias until standard libraries ship __cpp_lib_senders; every accommodation for it is marked DROP AT GRADUATION): - as_sender accepts compound io_result awaitables, splitting (ec, vs...) into set_error(ec) and set_value(vs...) channels; the task<error_code> workaround is gone. Splitting keys on io_result itself: only the type that declares element-0-is-outcome intent is split, and a generic tuple-like leading with error_code is a value. - completion channels are chosen by the operation's own disposition: an error comparing equal to errc::operation_canceled completes with set_stopped(), other errors with set_error(ec), and a successful result is delivered even when a stop request landed while the operation was finishing; the success path pays a bool test, not the category-virtual condition comparison - completion signatures are deduced from await_resume() at the query, where the CRTP Derived type is complete, via the C++26 static member function template mechanism ([exec.getcomplsigs]); nothing is stated twice and the advertisement cannot drift from the implementation - awaitable_sender_base<Derived> makes an op a sender natively; both protocols drive the identical awaitable members, and the documented dual-protocol contract (disposition reported in-band) makes the co_await and connect/start views provably consistent, pinned by cross-protocol tests - the AwaitableSender concept refines IoAwaitable with the sender requirements; both halves are structural, deriving the base is one way to satisfy it, and ensure_sender normalizes any IoAwaitable at a pipeline boundary (dual-protocol ops pass through, awaitable-only ops are lifted with as_sender) - shared op_state machinery drives the IoAwaitable protocol for both front-ends: receiver stop tokens of any stoppable_token type bridge into io_env's std::stop_token, get_io_executor is a forwarding query, and environments providing only a scheduler are served through an op_state-owned bridge, so bare sync_wait consumes capy ops end-to-end; a pmr::polymorphic_allocator in the environment lends its memory_resource as the frame allocator - ops keep data members private, the durable opt-out from sender decomposition (tag_of_t claims any type whose members admit a structured binding); read_op models the compliant shape and its stop-wait mode composes async_waker instead of hand-rolling stop-callback arming - example split into demo and test targets; 32 tests cover every completion channel through the adaptor, the native form, generic consumers, and both protocols; stop-dependent tests fail fast on timeout instead of hanging
|
An automated preview of the documentation is available at https://371.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-07-23 15:12:08 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #371 +/- ##
===========================================
+ Coverage 98.15% 98.33% +0.17%
===========================================
Files 76 152 +76
Lines 3913 8288 +4375
===========================================
+ Hits 3841 8150 +4309
- Misses 72 138 +66
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extend the awaitable-sender example so capy I/O awaitables participate in C++26 sender pipelines, written against std::execution names only (a bundled pre-standard implementation fills in through a single alias until standard libraries ship __cpp_lib_senders; every accommodation for it is marked DROP AT GRADUATION):