1
- #![ unstable(
2
- feature = "ip" ,
3
- reason = "extra functionality has not been \
4
- scrutinized to the level that it should \
5
- be to be stable",
6
- issue = "27709"
7
- ) ]
8
-
9
1
// Tests for this module
10
2
#[ cfg( all( test, not( target_os = "emscripten" ) ) ) ]
11
3
mod tests;
@@ -126,6 +118,7 @@ pub struct Ipv6Addr {
126
118
127
119
#[ allow( missing_docs) ]
128
120
#[ derive( Copy , PartialEq , Eq , Clone , Hash , Debug ) ]
121
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
129
122
pub enum Ipv6MulticastScope {
130
123
InterfaceLocal ,
131
124
LinkLocal ,
@@ -199,6 +192,7 @@ impl IpAddr {
199
192
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1)).is_global(), true);
200
193
/// ```
201
194
#[ rustc_const_unstable( feature = "const_ip" , issue = "76205" ) ]
195
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
202
196
#[ inline]
203
197
pub const fn is_global ( & self ) -> bool {
204
198
match self {
@@ -249,6 +243,7 @@ impl IpAddr {
249
243
/// );
250
244
/// ```
251
245
#[ rustc_const_unstable( feature = "const_ip" , issue = "76205" ) ]
246
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
252
247
#[ inline]
253
248
pub const fn is_documentation ( & self ) -> bool {
254
249
match self {
@@ -549,6 +544,7 @@ impl Ipv4Addr {
549
544
/// assert_eq!(Ipv4Addr::new(80, 9, 12, 3).is_global(), true);
550
545
/// ```
551
546
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
547
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
552
548
#[ inline]
553
549
pub const fn is_global ( & self ) -> bool {
554
550
// check if this address is 192.0.0.9 or 192.0.0.10. These addresses are the only two
@@ -587,6 +583,7 @@ impl Ipv4Addr {
587
583
/// assert_eq!(Ipv4Addr::new(100, 128, 0, 0).is_shared(), false);
588
584
/// ```
589
585
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
586
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
590
587
#[ inline]
591
588
pub const fn is_shared ( & self ) -> bool {
592
589
self . octets ( ) [ 0 ] == 100 && ( self . octets ( ) [ 1 ] & 0b1100_0000 == 0b0100_0000 )
@@ -620,6 +617,7 @@ impl Ipv4Addr {
620
617
/// assert_eq!(Ipv4Addr::new(191, 255, 255, 255).is_ietf_protocol_assignment(), false);
621
618
/// ```
622
619
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
620
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
623
621
#[ inline]
624
622
pub const fn is_ietf_protocol_assignment ( & self ) -> bool {
625
623
self . octets ( ) [ 0 ] == 192 && self . octets ( ) [ 1 ] == 0 && self . octets ( ) [ 2 ] == 0
@@ -644,6 +642,7 @@ impl Ipv4Addr {
644
642
/// assert_eq!(Ipv4Addr::new(198, 20, 0, 0).is_benchmarking(), false);
645
643
/// ```
646
644
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
645
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
647
646
#[ inline]
648
647
pub const fn is_benchmarking ( & self ) -> bool {
649
648
self . octets ( ) [ 0 ] == 198 && ( self . octets ( ) [ 1 ] & 0xfe ) == 18
@@ -677,6 +676,7 @@ impl Ipv4Addr {
677
676
/// assert_eq!(Ipv4Addr::new(255, 255, 255, 255).is_reserved(), false);
678
677
/// ```
679
678
#[ rustc_const_unstable( feature = "const_ipv4" , issue = "76205" ) ]
679
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
680
680
#[ inline]
681
681
pub const fn is_reserved ( & self ) -> bool {
682
682
self . octets ( ) [ 0 ] & 240 == 240 && !self . is_broadcast ( )
@@ -1234,6 +1234,7 @@ impl Ipv6Addr {
1234
1234
/// assert_eq!(Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1).is_global(), true);
1235
1235
/// ```
1236
1236
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1237
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1237
1238
#[ inline]
1238
1239
pub const fn is_global ( & self ) -> bool {
1239
1240
match self . multicast_scope ( ) {
@@ -1260,6 +1261,7 @@ impl Ipv6Addr {
1260
1261
/// assert_eq!(Ipv6Addr::new(0xfc02, 0, 0, 0, 0, 0, 0, 0).is_unique_local(), true);
1261
1262
/// ```
1262
1263
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1264
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1263
1265
#[ inline]
1264
1266
pub const fn is_unique_local ( & self ) -> bool {
1265
1267
( self . segments ( ) [ 0 ] & 0xfe00 ) == 0xfc00
@@ -1315,6 +1317,7 @@ impl Ipv6Addr {
1315
1317
/// [IETF RFC 4291 section 2.5.6]: https://tools.ietf.org/html/rfc4291#section-2.5.6
1316
1318
/// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
1317
1319
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1320
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1318
1321
#[ inline]
1319
1322
pub const fn is_unicast_link_local_strict ( & self ) -> bool {
1320
1323
matches ! ( self . segments( ) , [ 0xfe80 , 0 , 0 , 0 , ..] )
@@ -1369,6 +1372,7 @@ impl Ipv6Addr {
1369
1372
/// [IETF RFC 4291 section 2.4]: https://tools.ietf.org/html/rfc4291#section-2.4
1370
1373
/// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
1371
1374
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1375
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1372
1376
#[ inline]
1373
1377
pub const fn is_unicast_link_local ( & self ) -> bool {
1374
1378
( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfe80
@@ -1409,6 +1413,7 @@ impl Ipv6Addr {
1409
1413
///
1410
1414
/// [RFC 3879]: https://tools.ietf.org/html/rfc3879
1411
1415
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1416
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1412
1417
#[ inline]
1413
1418
pub const fn is_unicast_site_local ( & self ) -> bool {
1414
1419
( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfec0
@@ -1432,6 +1437,7 @@ impl Ipv6Addr {
1432
1437
/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_documentation(), true);
1433
1438
/// ```
1434
1439
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1440
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1435
1441
#[ inline]
1436
1442
pub const fn is_documentation ( & self ) -> bool {
1437
1443
( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0xdb8 )
@@ -1468,6 +1474,7 @@ impl Ipv6Addr {
1468
1474
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_unicast_global(), true);
1469
1475
/// ```
1470
1476
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1477
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1471
1478
#[ inline]
1472
1479
pub const fn is_unicast_global ( & self ) -> bool {
1473
1480
!self . is_multicast ( )
@@ -1494,6 +1501,7 @@ impl Ipv6Addr {
1494
1501
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).multicast_scope(), None);
1495
1502
/// ```
1496
1503
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1504
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1497
1505
#[ inline]
1498
1506
pub const fn multicast_scope ( & self ) -> Option < Ipv6MulticastScope > {
1499
1507
if self . is_multicast ( ) {
@@ -1555,6 +1563,7 @@ impl Ipv6Addr {
1555
1563
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1).to_ipv4_mapped(), None);
1556
1564
/// ```
1557
1565
#[ rustc_const_unstable( feature = "const_ipv6" , issue = "76205" ) ]
1566
+ #[ unstable( feature = "ip" , issue = "27709" ) ]
1558
1567
#[ inline]
1559
1568
pub const fn to_ipv4_mapped ( & self ) -> Option < Ipv4Addr > {
1560
1569
match self . octets ( ) {
0 commit comments