Add IpAddr common methods #34694

Merged
merged 4 commits into from Jul 20, 2016

Projects

None yet

8 participants

@mathphreak
Contributor
mathphreak commented Jul 6, 2016 edited

Per rust-lang/rfcs#1668 (comment) no RFC is needed here.

The generated documentation for these methods is being weird. It shows a deprecation message referencing #27709 for each of them even though two of the referenced methods were stabilized as part of that issue. I don't know how best to address that.

@rust-highfive
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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.

@mathphreak mathphreak referenced this pull request in rust-lang/rfcs Jul 6, 2016
Closed

Propose RFC for IpAddr common methods #1668

@sfackler sfackler and 1 other commented on an outdated diff Jul 7, 2016
src/libstd/net/ip.rs
@@ -59,6 +59,48 @@ pub enum Ipv6MulticastScope {
Global
}
+impl IpAddr {
+ /// Returns true for the special 'unspecified' address (0.0.0.0 in IPv4, :: in IPv6).
+ pub fn is_unspecified(&self) -> bool {
@sfackler
sfackler Jul 7, 2016 Member

These will all want to be marked unstable.

@mathphreak
mathphreak Jul 7, 2016 Contributor

@sfackler Should I use feature="ip" and issue="27709" or should I use a different feature or issue? (#27709 and feature="ip" are what the Ipv4/v6Addr convenience methods already use.)

@sfackler
sfackler Jul 7, 2016 Member

Yeah, I think reusing that issue and feature makes sense, unless @alexcrichton disagrees.

@canndrew canndrew referenced this pull request in rust-lang/rfcs Jul 7, 2016
Closed

Add convenience methods to IpAddr #1554

@alexcrichton alexcrichton added the T-libs label Jul 7, 2016
@alexcrichton
Member

Thanks @mathphreak! Perhaps the documentation could also link to the relevant methods on Ipv4Addr and Ipv6Addr as well? Other than that looks good to me, I've tagged with T-libs to ensure this comes up during triage, but I suspect we'll all be ok with it.

cc @rust-lang/libs

@mathphreak mathphreak Add links to Ipv*Addr methods in docs
58da5dd
@brson
Contributor
brson commented Jul 7, 2016

lgtm

@therealbstern therealbstern commented on the diff Jul 9, 2016
src/libstd/net/ip.rs
@@ -59,6 +59,66 @@ pub enum Ipv6MulticastScope {
Global
}
+impl IpAddr {
+ /// Returns true for the special 'unspecified' address ([IPv4], [IPv6]).
+ /// [IPv4]: ../../std/net/struct.Ipv4Addr.html#method.is_unspecified
+ /// [IPv6]: ../../std/net/struct.Ipv6Addr.html#method.is_unspecified
+ #[unstable(feature="ip", issue="27709",
+ reason="recently added and depends on unstable Ipv4Addr.is_unspecified()")]
@therealbstern
therealbstern Jul 9, 2016 edited Contributor

Per #27709 (comment), ipv4Addr.is_unspecified shouldn't be unstable (PR #34739 for stabilization).

@mathphreak
mathphreak Jul 9, 2016 Contributor

@therealbstern I'll keep an eye out for that PR and update this once it gets merged.

@bors bors added a commit that referenced this pull request Jul 13, 2016
@bors bors Auto merge of #34739 - therealbstern:ipv4unspec, r=alexcrichton
Mark Ipv4Addr is_unspecified as stable and provide reference.

Per [#27709 (comment)](#27709 (comment)), no RFC is needed here.

IPv4 "unspecified" has been defined in [Stevens], and has been part of the IPv4 stack for quite some time.  This property should become stable, since this use of 0.0.0.0 is not going anywhere.

[Stevens][_UNIX Network Programming Volume 1, Second Edition_.  Stevens, W. Richard.  Prentice-Hall, 1998.  p. 891]

Please let me know if I got the rustdoc wrong or something.  I tried to be as terse as possible while still conveying the appropriate information.

This also has a slight impact on PR #34694, but that one came first, so this shouldn't block it, IMO.
4bbb1c5
@aturon
Contributor
aturon commented Jul 13, 2016

I'm fine with these changes.

@alexcrichton
Member

Discussed today during libs triage we decided to merge, thanks again for the PR @mathphreak!

@alexcrichton
Member

@bors: r+

@bors
Contributor
bors commented Jul 19, 2016

📌 Commit 58da5dd has been approved by alexcrichton

@bors
Contributor
bors commented Jul 19, 2016

⌛️ Testing commit 58da5dd with merge e15afbc...

@bors bors added a commit that referenced this pull request Jul 19, 2016
@bors bors Auto merge of #34694 - mathphreak:master, r=alexcrichton
Add IpAddr common methods

Per rust-lang/rfcs#1668 (comment) no RFC is needed here.

The generated documentation for these methods is being weird. It shows a deprecation message referencing #27709 for each of them even though two of the referenced methods were stabilized as part of that issue. I don't know how best to address that.
e15afbc
@therealbstern

Can we remove these unstable marks? I believe is_unspecified is now accepted as stable for both address families.

Member

Soon! These APIs were just added and the libs team goes through a "final comment period" for stabilizing APIs. These APIs are slated to become stable in 1.12, though, tracked at #27709

@bors
Contributor
bors commented Jul 19, 2016

💔 Test failed - auto-win-msvc-32-opt

@alexcrichton
Member

@bors: retry

On Tue, Jul 19, 2016 at 12:08 PM, bors notifications@github.com wrote:

💔 Test failed - auto-win-msvc-32-opt
https://buildbot.rust-lang.org/builders/auto-win-msvc-32-opt/builds/4123


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#34694 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAD95KxdeUJkoNVpmf13MMooNzKAQFw8ks5qXSDAgaJpZM4JGlo0
.

@bors
Contributor
bors commented Jul 20, 2016

⌛️ Testing commit 58da5dd with merge d82b3cc...

@bors bors added a commit that referenced this pull request Jul 20, 2016
@bors bors Auto merge of #34694 - mathphreak:master, r=alexcrichton
Add IpAddr common methods

Per rust-lang/rfcs#1668 (comment) no RFC is needed here.

The generated documentation for these methods is being weird. It shows a deprecation message referencing #27709 for each of them even though two of the referenced methods were stabilized as part of that issue. I don't know how best to address that.
d82b3cc
@bors
Contributor
bors commented Jul 20, 2016

💔 Test failed - auto-win-msvc-64-opt-rustbuild

@alexcrichton
Member

@bors: retry

On Tue, Jul 19, 2016 at 9:15 PM, bors notifications@github.com wrote:

💔 Test failed - auto-win-msvc-64-opt-rustbuild
https://buildbot.rust-lang.org/builders/auto-win-msvc-64-opt-rustbuild/builds/1821


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#34694 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAD95G7Llj4WYWx87RUNYMgF-lZwfkzKks5qXaDPgaJpZM4JGlo0
.

@bors
Contributor
bors commented Jul 20, 2016

⌛️ Testing commit 58da5dd with merge 9d5965a...

@bors bors added a commit that referenced this pull request Jul 20, 2016
@bors bors Auto merge of #34694 - mathphreak:master, r=alexcrichton
Add IpAddr common methods

Per rust-lang/rfcs#1668 (comment) no RFC is needed here.

The generated documentation for these methods is being weird. It shows a deprecation message referencing #27709 for each of them even though two of the referenced methods were stabilized as part of that issue. I don't know how best to address that.
9d5965a
@bors bors merged commit 58da5dd into rust-lang:master Jul 20, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment