-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite std::net::ToSocketAddrs
doc examples.
#44117
Rewrite std::net::ToSocketAddrs
doc examples.
#44117
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hit a few travis errors
src/libstd/net/addr.rs
Outdated
/// ``` | ||
/// use std::net::{ToSocketAddrs, SocketAddr}; | ||
/// | ||
/// let mut addrs_iter = ((127, 0, 0, 1), 443).to_socket_addrs().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's not an impl for ((u8, u8, u8, u8), u16)
? Maybe you still need a Ipv4Addr::new
?
src/libstd/net/addr.rs
Outdated
/// // assuming 'localhost' resolves to 127.0.0.1 | ||
/// let mut addrs_iter = "localhost:443".to_socket_addrs().unwrap(); | ||
/// assert_eq!(addrs_iter.next(), Some(SocketAddr::from(([127, 0, 0, 1], 443)))); | ||
/// assert!(addrs_iter.next().is_none(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a close paren
src/libstd/net/addr.rs
Outdated
/// use std::io; | ||
/// use std::net::ToSocketAddrs; | ||
/// | ||
/// let err = "127.0.0:80".to_socket_addrs().unwrap_err(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually appears to have successfully called to_socket_addrs
o_O
called `Result::unwrap_err()` on an `Ok` value: IntoIter([V4(127.0.0.0:80)])
src/libstd/net/addr.rs
Outdated
/// | ||
/// let err = "127.0.0:80".to_socket_addrs().unwrap_err(); | ||
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput); | ||
/// ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is setting this to no_run
the right call? Especially if it actually resolved an address in the last run? If we want to show an example of it not resolving the address, we could just leave off the port; that will cause a failure.
src/libstd/net/addr.rs
Outdated
/// ``` | ||
/// use std::net::{ToSocketAddrs, SocketAddr}; | ||
/// | ||
/// let addr = SocketAddr::from(([127, 0, 0, 1], 443); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing close paren, this is the travis failure
tests pass now. i'll squash whenever this gets approved |
Looks good! Go ahead and squash and r=me. |
in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios
043382c
to
10bd39e
Compare
@bors r=QuietMisdreavus rollup |
📌 Commit 10bd39e has been approved by |
…xamples, r=QuietMisdreavus Rewrite `std::net::ToSocketAddrs` doc examples. in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios done this as preliminary work while investigating rust-lang#22569 note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
…xamples, r=QuietMisdreavus Rewrite `std::net::ToSocketAddrs` doc examples. in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios done this as preliminary work while investigating rust-lang#22569 note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
…xamples, r=QuietMisdreavus Rewrite `std::net::ToSocketAddrs` doc examples. in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios done this as preliminary work while investigating rust-lang#22569 note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
…xamples, r=QuietMisdreavus Rewrite `std::net::ToSocketAddrs` doc examples. in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios done this as preliminary work while investigating rust-lang#22569 note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
…xamples, r=QuietMisdreavus Rewrite `std::net::ToSocketAddrs` doc examples. in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios done this as preliminary work while investigating rust-lang#22569 note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
…xamples, r=QuietMisdreavus Rewrite `std::net::ToSocketAddrs` doc examples. in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios done this as preliminary work while investigating rust-lang#22569 note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving
in particular:
done this as preliminary work while investigating #22569
note: i haven't run doc tests on my machine for this, so would be good to confirm CI passes before approving