title: How can I define an async method in a trait?
body: <p>I have a trait that I'm using to abstract away <code>tokio::net::TcpStream</code> and <code>tokio::net::UnixStream</code>:</p>
  <pre><code>/// Interface for TcpStream and UnixStream.
  trait TryRead {
    // overlapping the name makes it hard to work with
    fn do_try_read(&amp;self, buf: &amp;mut [u8]) -&gt; Result&lt;usize, std::io::Error&gt;;
  }
  
  impl TryRead for TcpStream {
    fn do_try_read(&amp;self, buf: &amp;mut [u8]) -&gt; Result&lt;usize, std::io::Error&gt; {
        self.try_read(buf)
    }
  }
  </code></pre>
  <p>The problem is that I want to abstract away <code>pub async fn readable(&amp;self) -&gt; io::Result&lt;()&gt;</code> in both methods but async methods cannot be implemented in traits. How can I handle this?</p>