#How to use polling with a socket and stdin

6 messages · Page 1 of 1 (latest)

devout slate
#

Im new to the whole polling library completely so it would be good if someone could help me out

#

i tried this:

let poller = Poller::new()?;
poller.add(&std::io::stdin(), Event::readable(0))?;

but i get this error

16  |         poller.add(std::io::stdin(), Event::readable(0))?;
    |                ^^^ the trait `Source` is not implemented for `Stdin`
ionic ivy
#

I haven't heard of polling before but I would suggest using https://docs.rs/tokio/

#

async and Tokio is a very flexible way to write programs that need to respond to events from many sources

devout slate
#

i have no idea how to use async

#

im pretty sure it just uses polling under the hood