pub fn tcp<A: Into<SocketAddr>>(addr: A) -> io::Result<TcpStream> {
    let addr = addr.into();
    let domain = Domain::for_address(addr);
    let socket = connect(addr.into(), domain, Some(Protocol::TCP))?;
    Ok(socket.into())
}
/// Creates a pending TCP connection to the specified address.
///
/// The returned TCP stream will be in non-blocking mode and in the process of connecting to the
/// specified address.
///
/// The stream becomes writable when connected.
///
/// # Examples
///
/// ```
/// use polling::{Event, Poller};
/// use std::time::Duration;
///
/// // Create a pending TCP connection.
/// let stream = nb_connect::tcp(([127, 0, 0, 1], 80))?;
///
/// // Create a poller that waits for the stream to become writable.
/// let poller = Poller::new()?;
/// poller.add(&stream, Event::writable(0))?;
///
/// // Wait for at most 1 second.
/// if poller.wait(&mut Vec::new(), Some(Duration::from_secs(1)))? == 0 {
///     println!("timeout");
/// } else if let Some(err) = stream.take_error()? {
///     println!("error: {}", err);
/// } else {
///     println!("connected");
/// }
/// # std::io::Result::Ok(())
/// ```
Creates a pending TCP connection to the specified address.
The returned TCP stream will be in non-blocking mode and in the process of connecting to the
specified address.

The stream becomes writable when connected.
Creates a pending TCP connection to the specified address . The returned TCP stream will be in non - blocking mode and in the process of connecting to the specified address . The stream becomes writable when connected .
pub fn tcp<A: Into<SocketAddr>>(addr: A) -> io::Result<TcpStream> {
    let addr = addr.into();
    let domain = Domain::for_address(addr);
    let socket = connect(addr.into(), domain, Some(Protocol::TCP))?;
    Ok(socket.into())
}
pub fn tcp < A : Into < SocketAddr > > ( addr : A ) -> io :: Result < TcpStream > { let addr = addr . into ( ) ; let domain = Domain :: for_address ( addr ) ; let socket = connect ( addr . into ( ) , domain , Some ( Protocol :: TCP ) ) ? ; Ok ( socket . into ( ) ) }
Creates a pending TCP connection to the specified address.
Creates a pending TCP connection to the specified address .
addr
A
addr
A
examples
```
use polling::{Event, Poller};
use std::time::Duration.

Create a pending TCP connection.

Create a poller that waits for the stream to become writable.
let poller = Poller::new()?;
poller.add(&stream, Event::writable(0))?.

Wait for at most 1 second.
if poller.wait(&mut Vec::new(), Some(Duration::from_secs(1))). == 0 {
println!("timeout");
} else if let Some(err) = stream.take_error().
` ` ` use polling :: { Event Poller } ; use std :: time :: Duration . Create a pending TCP connection . Create a poller that waits for the stream to become writable . let poller = Poller :: new () ? ; poller . add ( &stream Event :: writable ( 0 )) ? . Wait for at most 1 second . if poller . wait ( &mut Vec :: new () Some ( Duration :: from_secs ( 1 ))) . == 0 { println! ( " timeout " ) ; } else if let Some ( err ) = stream . take_error () .
std::io::result::ok(())
None