feat(io): add traits for reading/writing with ancillary data#717
Merged
George-Miao merged 7 commits intocompio-rs:masterfrom Mar 25, 2026
Merged
feat(io): add traits for reading/writing with ancillary data#717George-Miao merged 7 commits intocompio-rs:masterfrom
George-Miao merged 7 commits intocompio-rs:masterfrom
Conversation
Berrysoft
reviewed
Feb 28, 2026
|
Been looking for cmsg methods on tcp stream as well 👍 |
Berrysoft
requested changes
Mar 1, 2026
2748a7c to
6914654
Compare
This was referenced Mar 4, 2026
6d5abc7 to
a40dbc4
Compare
This is not done in a way of making control param optional because send_with_ancillary() semantically requires a control buffer, but at the same time, send_with_ancillary() with empty control buffer is not practically identical to just send() as the latter may use different impl like send_zc in iour. Therefore, I decided to implicitly allow empty cmsg buffers as something like "enforce sendmsg impl, but send without control buffer".
Berrysoft
approved these changes
Mar 25, 2026
Member
Berrysoft
left a comment
There was a problem hiding this comment.
LGTM. But isn't the method name too long?
Also need @George-Miao to review.
George-Miao
approved these changes
Mar 25, 2026
Member
George-Miao
left a comment
There was a problem hiding this comment.
LGTM. I can't think of any shorter names tho, unless someone has better idea, let's keep it this way.
Closed
Open
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.
This adds runtime-agnostic stream APIs for reading/writing data with an ancillary buffer:
AsyncReadAncillary::read_with_ancillaryAsyncReadAncillary::read_vectored_with_ancillaryAsyncWriteAncillary::write_with_ancillaryAsyncWriteAncillary::write_vectored_with_ancillarySuch traits are behind a
compio-iofeature gateancillary. They are automatically implemented forTcpStreamandUnixStreamincompio-net.UdpSockethas its own cmsg API, and UDP is also not a stream.One implicit behavior in the write APIs is that, it accepts empty control buffers, in which case, the impl will use a null pointer with 0 length for ancillary data fields. See this commit for more details.