Uh oh!
There was an error while loading. Please reload this page.
clarify documentation of TcpStream::connect() for multiple valid addresses - #33167
Conversation
…esses Signed-off-by: benaryorg <binary@benary.org>
rust-highfive
commented
Apr 23, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
alexcrichton
commented
Apr 24, 2016
bors
commented
Apr 24, 2016
⌛ Testing commit 68a18c4 with merge 061cff6... |
bors
commented
Apr 24, 2016
💔 Test failed - auto-win-msvc-64-cargotest |
alexcrichton
commented
Apr 24, 2016
@bors: retry On Sun, Apr 24, 2016 at 4:46 AM, bors notifications@github.com wrote:
|
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(); } ```
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], a TCP fallback only being one.Just a little example program for anyone willing to enhance the documentation further: