@@ -113,10 +113,13 @@ impl Ipv4Addr {
113
113
114
114
/// Returns true if the address appears to be globally routable.
115
115
///
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)
120
123
pub fn is_global ( & self ) -> bool {
121
124
!self . is_private ( ) && !self . is_loopback ( ) && !self . is_link_local ( ) &&
122
125
!self . is_broadcast ( ) && !self . is_documentation ( )
@@ -284,9 +287,11 @@ impl Ipv6Addr {
284
287
285
288
/// Returns true if the address appears to be globally routable.
286
289
///
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
290
295
pub fn is_global ( & self ) -> bool {
291
296
match self . multicast_scope ( ) {
292
297
Some ( Ipv6MulticastScope :: Global ) => true ,
@@ -315,9 +320,12 @@ impl Ipv6Addr {
315
320
316
321
/// Returns true if the address is a globally routable unicast address.
317
322
///
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
321
329
pub fn is_unicast_global ( & self ) -> bool {
322
330
!self . is_multicast ( )
323
331
&& !self . is_loopback ( ) && !self . is_unicast_link_local ( )
0 commit comments