clarify documentation of TcpStream::connect() for multiple valid addresses

Signed-off-by: benaryorg <binary@benary.org>
This commit is contained in:
benaryorg 2016-04-23 17:50:16 +02:00
parent f01bb5ed24
commit 68a18c4dbc
No known key found for this signature in database
GPG key ID: D0073D31AB13D7F8

View file

@ -86,6 +86,8 @@ impl TcpStream {
/// `addr` is an address of the remote host. Anything which implements
/// `ToSocketAddrs` trait can be supplied for the address; see this trait
/// documentation for concrete examples.
/// In case `ToSocketAddrs::to_socket_addrs()` returns more than one entry,
/// then the first valid and reachable address is used.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn connect<A: ToSocketAddrs>(addr: A) -> io::Result<TcpStream> {
super::each_addr(addr, net_imp::TcpStream::connect).map(TcpStream)