feat(io,tls)!: require Splittable for AsyncStream#874
Merged
Berrysoft merged 18 commits intocompio-rs:masterfrom Apr 18, 2026
Merged
feat(io,tls)!: require Splittable for AsyncStream#874Berrysoft merged 18 commits intocompio-rs:masterfrom
Splittable for AsyncStream#874Berrysoft merged 18 commits intocompio-rs:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens I/O safety guarantees across TLS and WebSocket integration by requiring Splittable for streams that may be read and written concurrently (notably through compat::AsyncStream and TLS stream wrappers), and introduces a futures-util compatibility wrapper for MaybeTlsStream.
Changes:
- Require
util::Splittable(plusReadHalf/WriteHalfbounds) forcompio_io::compat::AsyncStreamand for TLS/WebSocket stream generics that rely on concurrent read/write. - Update
compio-tlsstream types (TlsStream,MaybeTlsStream, rustls acceptor types) to useSplittable-based bounds instead offor<'a> &'a S: AsyncRead + AsyncWrite. - Add
CompatMaybeTlsStreamandMaybeTlsStream::into_compat()to providefutures_util::AsyncRead/AsyncWritecompatibility.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| compio-ws/src/tls.rs | Updates WebSocket TLS helpers to require Splittable and half bounds for safe duplex usage. |
| compio-tls/src/stream.rs | Makes TlsStream require Splittable and expresses read/write capability via halves. |
| compio-tls/src/rtls.rs | Applies Splittable + half bounds to rustls lazy acceptor/handshake wrapper types. |
| compio-tls/src/maybe.rs | Makes MaybeTlsStream Splittable-based and adds CompatMaybeTlsStream + into_compat(). |
| compio-tls/src/adapter.rs | Updates TLS connector/acceptor APIs to require Splittable and half bounds. |
| compio-tls/Cargo.toml | Makes futures-util non-optional to match unconditional usage. |
| compio-io/src/compat/async_stream.rs | Reworks AsyncStream to require Splittable and internally split into read/write halves. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
George-Miao
reviewed
Apr 17, 2026
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.
Previously we require
for<'a> &'a S: AsyncRead + AsyncWriteto ensure that the inner stream is OK to be calledreadandwritesimultaneously, but it is not perfect. A user can still construct unsound code with it. Now we requireSplittabledirectly for safety.A new type
CompatMaybeTlsStreamInneris also added to loose the type requirements. After this PR, I think I'll rewritecompio-wsto use it and make the websocket stream splittable directly without another compat type.