@@ -1240,7 +1240,8 @@ impl Ipv6Addr {
1240
1240
match self . multicast_scope ( ) {
1241
1241
Some ( Ipv6MulticastScope :: Global ) => true ,
1242
1242
None => {
1243
- self . is_unicast_global ( ) && !( self . is_unique_local ( ) || self . is_documentation ( ) )
1243
+ self . has_unicast_global_scope ( )
1244
+ && !( self . is_unique_local ( ) || self . is_documentation ( ) )
1244
1245
}
1245
1246
_ => false ,
1246
1247
}
@@ -1331,20 +1332,20 @@ impl Ipv6Addr {
1331
1332
/// use std::net::Ipv6Addr;
1332
1333
///
1333
1334
/// // The loopback address (`::1`) does not actually have link-local scope.
1334
- /// assert_eq!(Ipv6Addr::LOCALHOST.is_unicast_link_local (), false);
1335
+ /// assert_eq!(Ipv6Addr::LOCALHOST.has_unicast_link_local_scope (), false);
1335
1336
///
1336
1337
/// // Only addresses in `fe80::/10` have link-local scope.
1337
- /// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_unicast_link_local (), false);
1338
- /// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 0).is_unicast_link_local (), true);
1338
+ /// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).has_unicast_link_local_scope (), false);
1339
+ /// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 0).has_unicast_link_local_scope (), true);
1339
1340
///
1340
1341
/// // Addresses outside the stricter `fe80::/64` also have link-local scope.
1341
- /// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 1, 0, 0, 0, 0).is_unicast_link_local (), true);
1342
- /// assert_eq!(Ipv6Addr::new(0xfe81, 0, 0, 0, 0, 0, 0, 0).is_unicast_link_local (), true);
1342
+ /// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 1, 0, 0, 0, 0).has_unicast_link_local_scope (), true);
1343
+ /// assert_eq!(Ipv6Addr::new(0xfe81, 0, 0, 0, 0, 0, 0, 0).has_unicast_link_local_scope (), true);
1343
1344
/// ```
1344
1345
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1345
1346
#[ unstable( feature = "ip" , issue = "27709" ) ]
1346
1347
#[ inline]
1347
- pub const fn is_unicast_link_local ( & self ) -> bool {
1348
+ pub const fn has_unicast_link_local_scope ( & self ) -> bool {
1348
1349
( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfe80
1349
1350
}
1350
1351
@@ -1403,7 +1404,7 @@ impl Ipv6Addr {
1403
1404
/// [RFC 4291 section 2.5.7]: https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.7
1404
1405
/// [unspecified address]: Ipv6Addr::is_unspecified
1405
1406
/// [loopback address]: Ipv6Addr::is_loopback
1406
- /// [link-local address]: Ipv6Addr::is_unicast_link_local
1407
+ /// [link-local address]: Ipv6Addr::has_unicast_link_local_scope
1407
1408
///
1408
1409
/// # Examples
1409
1410
///
@@ -1413,33 +1414,33 @@ impl Ipv6Addr {
1413
1414
/// use std::net::Ipv6Addr;
1414
1415
///
1415
1416
/// // The unspecified address (`::`) does not have unicast global scope
1416
- /// assert_eq!(Ipv6Addr::UNSPECIFIED.is_unicast_global (), false);
1417
+ /// assert_eq!(Ipv6Addr::UNSPECIFIED.has_unicast_global_scope (), false);
1417
1418
///
1418
1419
/// // The loopback address (`::1`) does not have unicast global scope.
1419
- /// assert_eq!(Ipv6Addr::LOCALHOST.is_unicast_global (), false);
1420
+ /// assert_eq!(Ipv6Addr::LOCALHOST.has_unicast_global_scope (), false);
1420
1421
///
1421
1422
/// // A unicast address with link-local scope (`fe80::/10`) does not have global scope.
1422
- /// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 0).is_unicast_global (), false);
1423
+ /// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 0, 0, 0, 0, 0).has_unicast_global_scope (), false);
1423
1424
///
1424
1425
/// // A unicast address that had the deprecated site-local scope (`fec0::/10`) now has global scope.
1425
- /// assert_eq!(Ipv6Addr::new(0xfec2, 0, 0, 0, 0, 0, 0, 0).is_unicast_global (), true);
1426
+ /// assert_eq!(Ipv6Addr::new(0xfec2, 0, 0, 0, 0, 0, 0, 0).has_unicast_global_scope (), true);
1426
1427
///
1427
1428
/// // Any multicast address (`ff00::/8`) does not have unicast global scope;
1428
1429
/// // there is a difference between unicast global scope and multicast global scope.
1429
- /// assert_eq!(Ipv6Addr::new(0xff03, 0, 0, 0, 0, 0, 0, 0).is_unicast_global (), false);
1430
- /// assert_eq!(Ipv6Addr::new(0xff0e, 0, 0, 0, 0, 0, 0, 0).is_unicast_global (), false);
1430
+ /// assert_eq!(Ipv6Addr::new(0xff03, 0, 0, 0, 0, 0, 0, 0).has_unicast_global_scope (), false);
1431
+ /// assert_eq!(Ipv6Addr::new(0xff0e, 0, 0, 0, 0, 0, 0, 0).has_unicast_global_scope (), false);
1431
1432
///
1432
1433
/// // Any other address is defined as having unicast global scope.
1433
- /// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_unicast_global (), true);
1434
+ /// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).has_unicast_global_scope (), true);
1434
1435
/// ```
1435
1436
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1436
1437
#[ unstable( feature = "ip" , issue = "27709" ) ]
1437
1438
#[ inline]
1438
- pub const fn is_unicast_global ( & self ) -> bool {
1439
+ pub const fn has_unicast_global_scope ( & self ) -> bool {
1439
1440
self . is_unicast ( )
1440
1441
&& !self . is_unspecified ( )
1441
1442
&& !self . is_loopback ( )
1442
- && !self . is_unicast_link_local ( )
1443
+ && !self . has_unicast_link_local_scope ( )
1443
1444
}
1444
1445
1445
1446
/// Returns the address's multicast scope if the address is multicast.
0 commit comments