Skip to content
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

Merged
merged 1 commit into from
Aug 30, 2017

Conversation

frewsxcv
Copy link
Member

in particular:

  • show how to create an iterator that yields multiple socket addresses
  • show more failing scenarios

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

@rust-highfive
Copy link
Collaborator

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@frewsxcv frewsxcv assigned QuietMisdreavus and unassigned sfackler Aug 27, 2017
Copy link
Member

@QuietMisdreavus QuietMisdreavus left a 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

/// ```
/// use std::net::{ToSocketAddrs, SocketAddr};
///
/// let mut addrs_iter = ((127, 0, 0, 1), 443).to_socket_addrs().unwrap();
Copy link
Member

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?

/// // 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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a close paren

/// use std::io;
/// use std::net::ToSocketAddrs;
///
/// let err = "127.0.0:80".to_socket_addrs().unwrap_err();
Copy link
Member

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)])

///
/// let err = "127.0.0:80".to_socket_addrs().unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
/// ```
Copy link
Member

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.

/// ```
/// use std::net::{ToSocketAddrs, SocketAddr};
///
/// let addr = SocketAddr::from(([127, 0, 0, 1], 443);
Copy link
Member

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

@frewsxcv
Copy link
Member Author

tests pass now. i'll squash whenever this gets approved

@carols10cents carols10cents added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2017
@QuietMisdreavus
Copy link
Member

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
@frewsxcv frewsxcv force-pushed the frewsxcv-to-socket-addrs-examples branch from 043382c to 10bd39e Compare August 28, 2017 13:23
@frewsxcv
Copy link
Member Author

@bors r=QuietMisdreavus rollup

@bors
Copy link
Contributor

bors commented Aug 28, 2017

📌 Commit 10bd39e has been approved by QuietMisdreavus

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 29, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 29, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 29, 2017
…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
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Aug 29, 2017
…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
@arielb1 arielb1 added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 29, 2017
arielb1 pushed a commit to arielb1/rust that referenced this pull request Aug 29, 2017
…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
arielb1 pushed a commit to arielb1/rust that referenced this pull request Aug 29, 2017
…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
bors added a commit that referenced this pull request Aug 29, 2017
Rollup of 12 pull requests

- Successful merges: #43705, #43778, #43918, #44076, #44117, #44121, #44126, #44134, #44135, #44141, #44144, #44158
- Failed merges:
@bors bors merged commit 10bd39e into rust-lang:master Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants