Skip to content

Commit 45b9a34

Browse files
committed
Auto merge of #25044 - tshepang:doc-addr, r=alexcrichton
2 parents ce1150b + f86da3d commit 45b9a34

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/libstd/net/ip.rs

+18-10
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,13 @@ impl Ipv4Addr {
113113

114114
/// Returns true if the address appears to be globally routable.
115115
///
116-
/// Non-globally-routable networks include the private networks (10.0.0.0/8,
117-
/// 172.16.0.0/12 and 192.168.0.0/16), the loopback network (127.0.0.0/8),
118-
/// the link-local network (169.254.0.0/16), the broadcast address (255.255.255.255/32) and
119-
/// the test networks used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24).
116+
/// The following return false:
117+
///
118+
/// - private address (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16)
119+
/// - the loopback address (127.0.0.0/8)
120+
/// - the link-local address (169.254.0.0/16)
121+
/// - the broadcast address (255.255.255.255/32)
122+
/// - test addresses used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24)
120123
pub fn is_global(&self) -> bool {
121124
!self.is_private() && !self.is_loopback() && !self.is_link_local() &&
122125
!self.is_broadcast() && !self.is_documentation()
@@ -284,9 +287,11 @@ impl Ipv6Addr {
284287

285288
/// Returns true if the address appears to be globally routable.
286289
///
287-
/// Non-globally-routable networks include the loopback address; the
288-
/// link-local, site-local, and unique local unicast addresses; and the
289-
/// interface-, link-, realm-, admin- and site-local multicast addresses.
290+
/// The following return false:
291+
///
292+
/// - the loopback address
293+
/// - link-local, site-local, and unique local unicast addresses
294+
/// - interface-, link-, realm-, admin- and site-local multicast addresses
290295
pub fn is_global(&self) -> bool {
291296
match self.multicast_scope() {
292297
Some(Ipv6MulticastScope::Global) => true,
@@ -315,9 +320,12 @@ impl Ipv6Addr {
315320

316321
/// Returns true if the address is a globally routable unicast address.
317322
///
318-
/// Non-globally-routable unicast addresses include the loopback address,
319-
/// the link-local addresses, the deprecated site-local addresses and the
320-
/// unique local addresses.
323+
/// The following return false:
324+
///
325+
/// - the loopback address
326+
/// - the link-local addresses
327+
/// - the (deprecated) site-local addresses
328+
/// - unique local addresses
321329
pub fn is_unicast_global(&self) -> bool {
322330
!self.is_multicast()
323331
&& !self.is_loopback() && !self.is_unicast_link_local()

0 commit comments

Comments
 (0)