-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add IpAddr common methods #34694
Add IpAddr common methods #34694
Conversation
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. |
@@ -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 { |
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.
These will all want to be marked unstable.
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.
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.
Yeah, I think reusing that issue and feature makes sense, unless @alexcrichton disagrees.
Thanks @mathphreak! Perhaps the documentation could also link to the relevant methods on cc @rust-lang/libs |
lgtm |
/// [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()")] |
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.
Per #27709 (comment), ipv4Addr.is_unspecified shouldn't be unstable (PR #34739 for stabilization).
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.
@therealbstern I'll keep an eye out for that PR and update this once it gets merged.
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.
I'm fine with these changes. |
Discussed today during libs triage we decided to merge, thanks again for the PR @mathphreak! |
@bors: r+ |
📌 Commit 58da5dd has been approved by |
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.
💔 Test failed - auto-win-msvc-32-opt |
@bors: retry On Tue, Jul 19, 2016 at 12:08 PM, bors notifications@github.com wrote:
|
⌛ Testing commit 58da5dd with merge d82b3cc... |
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
@bors: retry On Tue, Jul 19, 2016 at 9:15 PM, bors notifications@github.com wrote:
|
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.
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.