async fn accept(&mut self) -> Result<Arc<Mutex<dyn Connection + Send>>, String> {
        let stream = self.listener.accept().await;
        if stream.is_err() {
            Err("accept failed".into())
        } else {
            let (stream, _) = stream.unwrap();
            Ok(TcpConnection::new_from_stream(stream).await)
        }
    }
/// Accepts an incoming connection request and returns a [`Connection`]
/// trait object reference.
///
/// # Examples
/// ```ignore
/// use ockam_transport_tcp::listener::TcpListener;
/// use std::net::SocketAddr;
/// use std::str::FromStr;
///
/// let address = SocketAddr::from_str("127.0.0.1:8080").unwrap();
/// let listener = TcpListener::create(address);
/// let connection = listener.accept().await.unwrap();
/// ```
Accepts an incoming connection request and returns a [`Connection`]
trait object reference.
Accepts an incoming connection request and returns a [ ` Connection ` ] trait object reference .
async fn accept(&mut self) -> Result<Arc<Mutex<dyn Connection + Send>>, String> {
        let stream = self.listener.accept().await;
        if stream.is_err() {
            Err("accept failed".into())
        } else {
            let (stream, _) = stream.unwrap();
            Ok(TcpConnection::new_from_stream(stream).await)
        }
    }
async fn accept ( & mut self ) -> Result < Arc < Mutex < dyn Connection + Send > > , String > { let stream = self . listener . accept ( ) . await ; if stream . is_err ( ) { Err ( " " . into ( ) ) } else { let ( stream , _ ) = stream . unwrap ( ) ; Ok ( TcpConnection :: new_from_stream ( stream ) . await ) } }
Accepts an incoming connection request and returns a [`Connection`]
trait object reference.
Accepts an incoming connection request and returns a [ ` Connection ` ] trait object reference .
&mut self
&mut self
examples
```ignore
use ockam_transport_tcp::listener::TcpListener;
use std::net::SocketAddr;
use std::str::FromStr.

let address = SocketAddr::from_str("127.0.0.1:8080").unwrap();
let listener = TcpListener::create(address);
let connection = listener.accept().await.unwrap();
```
` ` ` ignore use ockam_transport_tcp :: listener :: TcpListener ; use std :: net :: SocketAddr ; use std :: str :: FromStr . let address = SocketAddr :: from_str ( " 127 . 0 . 0 . 1 : 8080 " ) . unwrap () ; let listener = TcpListener :: create ( address ) ; let connection = listener . accept () . await . unwrap () ; ` ` `