@@ -1539,8 +1539,9 @@ impl Ipv6Addr {
1539
1539
/// // Addresses reserved for benchmarking (`2001:2::/48`)
1540
1540
/// assert_eq!(Ipv6Addr::new(0x2001, 2, 0, 0, 0, 0, 0, 1,).is_global(), false);
1541
1541
///
1542
- /// // Addresses reserved for documentation (`2001:db8::/32`)
1542
+ /// // Addresses reserved for documentation (`2001:db8::/32` and `3fff::/20` )
1543
1543
/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1).is_global(), false);
1544
+ /// assert_eq!(Ipv6Addr::new(0x3fff, 0, 0, 0, 0, 0, 0, 0).is_global(), false);
1544
1545
///
1545
1546
/// // Unique local addresses (`fc00::/7`)
1546
1547
/// assert_eq!(Ipv6Addr::new(0xfc02, 0, 0, 0, 0, 0, 0, 1).is_global(), false);
@@ -1686,11 +1687,12 @@ impl Ipv6Addr {
1686
1687
}
1687
1688
1688
1689
/// Returns [`true`] if this is an address reserved for documentation
1689
- /// (`2001:db8::/32`).
1690
+ /// (`2001:db8::/32` and `3fff::/20` ).
1690
1691
///
1691
- /// This property is defined in [IETF RFC 3849].
1692
+ /// This property is defined by [IETF RFC 3849] and [IETF RFC 9637 ].
1692
1693
///
1693
1694
/// [IETF RFC 3849]: https://tools.ietf.org/html/rfc3849
1695
+ /// [IETF RFC 9637]: https://tools.ietf.org/html/rfc9637
1694
1696
///
1695
1697
/// # Examples
1696
1698
///
@@ -1701,12 +1703,13 @@ impl Ipv6Addr {
1701
1703
///
1702
1704
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_documentation(), false);
1703
1705
/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_documentation(), true);
1706
+ /// assert_eq!(Ipv6Addr::new(0x3fff, 0, 0, 0, 0, 0, 0, 0).is_documentation(), true);
1704
1707
/// ```
1705
1708
#[ unstable( feature = "ip" , issue = "27709" ) ]
1706
1709
#[ must_use]
1707
1710
#[ inline]
1708
1711
pub const fn is_documentation ( & self ) -> bool {
1709
- ( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0xdb8 )
1712
+ matches ! ( self . segments( ) , [ 0x2001 , 0xdb8 , .. ] | [ 0x3fff , 0 ..= 0x0fff , .. ] )
1710
1713
}
1711
1714
1712
1715
/// Returns [`true`] if this is an address reserved for benchmarking (`2001:2::/48`).
0 commit comments