Skip to content

Comments

Add TcpStream::ready#259

Open
teskje wants to merge 1 commit intotokio-rs:mainfrom
teskje:tcpstream-ready
Open

Add TcpStream::ready#259
teskje wants to merge 1 commit intotokio-rs:mainfrom
teskje:tcpstream-ready

Conversation

@teskje
Copy link
Contributor

@teskje teskje commented Dec 25, 2025

This adds a TcpStream::ready method, increasing compatibility with the tokio API.

This implementation only supports READABLE and WRITABLE interests. If ready is invoked without any supported interests, it hangs forever, matching tokio's current behavior.

Note that this implementation of TcpStream::ready takes &mut self, whereas tokio's takes &self. This deviation is currently required because peeking the read buffer requires &mut self in turmoil. We can fix that once/if #260 lands.

@teskje teskje marked this pull request as ready for review December 25, 2025 11:08
This adds a `TcpStream::ready` method, increasing compatibility with the
tokio API.

This implementation only supports `READABLE` and `WRITABLE` interests.
If `ready` is invoked without any supported interests, it hangs forever,
matching tokio's current behavior.

Note that this implementation of `TcpStream::ready` takes `&mut self`,
whereas tokio's takes `&self`. This deviation is currently required
because peeking the read buffer requires `&mut self` in turmoil. We can
fix that independently.
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