Skip to content

Commit

Permalink
Auto merge of #34739 - therealbstern:ipv4unspec, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors authored Jul 13, 2016
2 parents 26fd011 + cd487db commit 4bbb1c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libstd/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ impl Ipv4Addr {
}

/// Returns true for the special 'unspecified' address (0.0.0.0).
///
/// This property is defined in _UNIX Network Programming, Second Edition_,
/// W. Richard Stevens, p. 891; see also [ip7]
/// [ip7][http://man7.org/linux/man-pages/man7/ip.7.html]
pub fn is_unspecified(&self) -> bool {
self.inner.s_addr == 0
}
Expand Down

0 comments on commit 4bbb1c5

Please sign in to comment.