title: How to do async read from Framed
body: <p>I can read from TcpStream in async fashion using <code>tokio::select!</code> like this:</p>
  <pre><code>        let listener = Self::build_listener(6666).await.expect(&quot;TCP listener bind error&quot;); //  TcpListener::bind(&quot;localhost:&quot;.to_string() + &amp;port.to_string()).await
          tokio::spawn(async move {
              let accept = listener.accept().await;
              match accept {
                  Result::Err(e) =&gt; warn!(&quot;Unable to accept connection: {}&quot;, e),
                  Result::Ok((mut socket, socket_addr)) =&gt; {
                      info!(&quot;Socket opened {}&quot;, socket_addr);
                      let mut buf = vec![0; 1024];
                      loop {
                          tokio::select! { // great!
                              result = socket.read(&amp;mut buf) =&gt; {
                                 //code
                              }
                          }
                      }
  
                  }
              }
          });
  </code></pre>
  <p>How can I do the same thing with Framed (LengthDelimitedCodec) ?</p>
  <pre><code>        let listener = Self::build_listener(6666).await.expect(&quot;TCP listener bind error&quot;); //  TcpListener::bind(&quot;localhost:&quot;.to_string() + &amp;port.to_string()).await
          tokio::spawn(async move {
              let accept = listener.accept().await;
              match accept {
                  Result::Err(e) =&gt; warn!(&quot;Unable to accept connection: {}&quot;, e),
                  Result::Ok((mut socket, socket_addr)) =&gt; {
                      info!(&quot;Socket opened {}&quot;, socket_addr);
                      let framed_socket = LengthDelimitedCodec::builder()
                      .length_field_offset(0)
                      .length_field_length(4)
                      .length_adjustment(0)
                      .max_frame_length(max_packet).new_framed(socket);
                      loop {
                          tokio::select! {
                              result = framed_socket.read() =&gt; { // no such async alternative 
                                //code
                              }
                          }
                      }
  
                  }
              }
          });
  </code></pre>
  <p>I found two ways of doing that: to write own async decoder or to wrap <code>framed_socket</code> in future (using <code>framed_socket.poll_next</code> for check). Maybe I missed something?</p>