Channels that can be polled with I/O events together?

Probably a dumb question: In sync Rust, is there any implementation of channel that allows channels to be polled with other I/O events together?

For example, I hope the crate polling can poll events from sockets and some Rust channels at the same time. (I don't think it can unless I'm completely wrong).

I've not found any yet. But just as a wishful thinking, wondering if that's possible (in sync Rust) or if already exists but I didn't know?

(By "channels", I meant something similar to flume)

One way or another, you have to turn the different events into similar events. Here are three ways:

  1. Use async Rust — being able to select among many futures of different types is one of the strengths of async.
  2. Turn your IO events into messages on channels, then use your channel library's “select” mechanism for receiving from multiple channels (both crossbeam and flume have this).
  3. Turn your channel messages into IO events (e.g. open a pipe to yourself) and use something that watches FDs/handles.

Personally, I prefer async.


Not an answer, but mio is another popular polling library.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.