about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-04-26 01:44:51 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-04-26 01:44:51 +0530
commit4c0fdebe7bbca73c16f9a5ea908a0478e2de3822 (patch)
tree24af838c94707b5c025a2f4e61d309482d1c2d02 /src/libsyntax
parentb588f6903dff7a04e094119232c3e980591ecdfc (diff)
parent68a18c4dbc8589a6cffcf16626e3d57633b32463 (diff)
downloadrust-4c0fdebe7bbca73c16f9a5ea908a0478e2de3822.tar.gz
rust-4c0fdebe7bbca73c16f9a5ea908a0478e2de3822.zip
Rollup merge of #33167 - benaryorg:master, r=alexcrichton
clarify documentation of TcpStream::connect() for multiple valid addresses

I am not sure how the UDP part of the stdlib behaves when passing multiple valid addresses, but it should be mentioned as there are legit use cases for [`impl<'a> ToSocketAddrs for &'a [SocketAddr]`](http://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html), a TCP fallback only being one.

Just a little example program for anyone willing to enhance the documentation further:

```rust
use std::net::SocketAddr;
use std::net::ToSocketAddrs;
use std::net::TcpStream;

fn main()
{
	let v: Vec<SocketAddr> = vec!
	[
		"127.0.0.1:1338".to_socket_addrs().unwrap().next().unwrap(),
		"127.0.0.1:1337".to_socket_addrs().unwrap().next().unwrap(),
		"127.0.0.1:1339".to_socket_addrs().unwrap().next().unwrap(),
	];

	let stream = TcpStream::connect(&v[..]).unwrap();
}
```
Diffstat (limited to 'src/libsyntax')
0 files changed, 0 insertions, 0 deletions