We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
to_ne_bytes
1 parent 527b8d4 commit 87f5a98Copy full SHA for 87f5a98
src/libstd/net/ip.rs
@@ -393,8 +393,7 @@ impl Ipv4Addr {
393
/// ```
394
#[stable(feature = "rust1", since = "1.0.0")]
395
pub fn octets(&self) -> [u8; 4] {
396
- let bits = u32::from_be(self.inner.s_addr);
397
- [(bits >> 24) as u8, (bits >> 16) as u8, (bits >> 8) as u8, bits as u8]
+ self.inner.s_addr.to_ne_bytes()
398
}
399
400
/// Returns [`true`] for the special 'unspecified' address (0.0.0.0).
0 commit comments