feat(net)!: remove owned halves#915
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the dedicated “owned split half” wrapper types from compio-net and instead represents owned halves as the stream type itself (e.g., TcpStream, UnixStream), aligning with the repo’s general approach for ref-counted I/O handles.
Changes:
- Change
TcpStream::into_split/UnixStream::into_splitto return(Self, Self)viacloneinstead ofOwnedReadHalf/OwnedWriteHalf. - Update
Splittableimplementations forTcpStreamandUnixStreamto useSelfas bothReadHalfandWriteHalf. - Remove the reunite-focused test and add
Derefsupport for borrowedReadHalf/WriteHalfwrappers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| compio-net/tests/split.rs | Removes the reunite/unsplit test that depended on the deleted owned-half types. |
| compio-net/src/unix.rs | Switches UnixStream::into_split and Splittable owned halves to (UnixStream, UnixStream) via cloning. |
| compio-net/src/tcp.rs | Switches TcpStream::into_split and Splittable owned halves to (TcpStream, TcpStream) via cloning. |
| compio-net/src/split.rs | Deletes owned-half wrappers and reunite error; adds Deref for borrowed ReadHalf/WriteHalf. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AsakuraMizu
left a comment
There was a problem hiding this comment.
Should we also update the document of Splittable?
|
The docs of
I think it's still valid. |
compio upstream removed OwnedWriteHalf/OwnedReadHalf (compio-rs/compio#915). Use cloned streams directly; AsyncWrite is implemented on &TcpStream/&UnixStream.
compio upstream removed OwnedWriteHalf/OwnedReadHalf (compio-rs/compio#915). Use cloned streams directly; AsyncWrite is implemented on &TcpStream/&UnixStream.
We don't use a separate type for
File, named pipe, orAsyncFd. It's meaningless to assign a new type now. Let's just make the half types itself.