title: How can I read non-blocking from stdin?
body: <p>Is there a way to check whether data is available on <code>stdin</code> in Rust, or to do a read that returns immediately with the currently available data?</p>
  
  <p>My goal is to be able to read the input produced for instance by cursor keys in a shell that is setup to return all read data immediately. For instance with an equivalent to: <code>stty -echo -echok -icanon min 1 time 0</code>.</p>
  
  <p>I suppose one solution would be to use ncurses or similar libraries, but I would like to avoid any kind of large dependencies.</p>
  
  <p>So far, I got only blocking input, which is not what I want:</p>
  
  <pre><code>let mut reader = stdin();
  let mut s = String::new();
  
  match reader.read_to_string(&amp;mut s) {...} // this blocks :(
  </code></pre>