-
Notifications
You must be signed in to change notification settings - Fork 15
tokio-stdio - what do you think of this? #7
Comments
Hm I may not quite be following, but are you basically thinking of having handles (implementing the |
That is exactly what I meant! If stdin/stdout/stderr of the current process could be used with futures, I imagine it would be easier to write asynchronous futurized command-line tools. Asked differently: Is it possible to use stdin/stdout/stderr with tokio core? All implementations of It's very likely that I am missing something fundamental here, as I am currently struggling to implement the functionality mentioned in my first comment. |
At it's fundamental level this is sort of blocked on tokio-rs/mio#321. You can emulate it today sorta but it needs support at some core level. In general for small CLI tools and such what you probably want to do is to use channels to communicate to foreign threads. You can have a thread per stdin/stdout/stderr with a |
Thanks a lot for the heads-up! I will try to use |
In order to get started with Tokio and futures, I decided to make a little command-line tool which should help to interact with crates-io.
The idea of the search subcommand is to allow the user to type anything, and have it request the search result automatically for each keystroke.
As I thought it might be ideal to futurerize the
stdio()
function of this crate, I put to life thetokio-stdio
crate, which might contain no more than said function at first. Ideally, it could be used by this crate too.Do you think this is feasible at all, or am I on the wrong track?
Note: The problem at hand could already be solved with a futures_cpupool, but in an ideal world, one wouldn't need more than the main thread.
The text was updated successfully, but these errors were encountered: