diff options
| author | hltj <jiaywe@gmail.com> | 2024-12-20 11:47:02 +0800 |
|---|---|---|
| committer | hltj <jiaywe@gmail.com> | 2024-12-20 11:47:02 +0800 |
| commit | eef749819b2492f470ddcf075b372e9b13ecb7d1 (patch) | |
| tree | 30314fb02229fe7e45d3e378837e46bb68c7f7dc | |
| parent | 3bf62ccc1055a94dfa6a72650b10a71dcf232429 (diff) | |
| download | rust-eef749819b2492f470ddcf075b372e9b13ecb7d1.tar.gz rust-eef749819b2492f470ddcf075b372e9b13ecb7d1.zip | |
fix typos in the example code in the doc comments of `Ipv4Addr::from_bits()`, `Ipv6Addr::from_bits()` & `Ipv6Addr::to_bits()`
| -rw-r--r-- | library/core/src/net/ip_addr.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/net/ip_addr.rs b/library/core/src/net/ip_addr.rs index 82f11f0eaac..7dd5c214012 100644 --- a/library/core/src/net/ip_addr.rs +++ b/library/core/src/net/ip_addr.rs @@ -527,7 +527,7 @@ impl Ipv4Addr { /// ``` /// use std::net::Ipv4Addr; /// - /// let addr = Ipv4Addr::from(0x12345678); + /// let addr = Ipv4Addr::from_bits(0x12345678); /// assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x78), addr); /// ``` #[rustc_const_stable(feature = "ip_bits", since = "1.80.0")] @@ -1294,7 +1294,7 @@ impl Ipv6Addr { /// 0x1020, 0x3040, 0x5060, 0x7080, /// 0x90A0, 0xB0C0, 0xD0E0, 0xF00D, /// ); - /// assert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128, u128::from(addr)); + /// assert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128, addr.to_bits()); /// ``` /// /// ``` @@ -1330,7 +1330,7 @@ impl Ipv6Addr { /// ``` /// use std::net::Ipv6Addr; /// - /// let addr = Ipv6Addr::from(0x102030405060708090A0B0C0D0E0F00D_u128); + /// let addr = Ipv6Addr::from_bits(0x102030405060708090A0B0C0D0E0F00D_u128); /// assert_eq!( /// Ipv6Addr::new( /// 0x1020, 0x3040, 0x5060, 0x7080, |
