Skip to content

Commit 9aa4d06

Browse files
committed
Add documentation to help people find Ipv4Addr::UNSPECIFIED
People looking for `INADDR_ANY` don't always find `Ipv4Addr::UNSPECIFIED`; add some documentation and an alias to help.
1 parent 0cc00c4 commit 9aa4d06

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/std/src/net/ip.rs

+3
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ impl Ipv4Addr {
334334

335335
/// An IPv4 address representing an unspecified address: 0.0.0.0
336336
///
337+
/// This corresponds to the constant `INADDR_ANY` in other languages.
338+
///
337339
/// # Examples
338340
///
339341
/// ```
@@ -342,6 +344,7 @@ impl Ipv4Addr {
342344
/// let addr = Ipv4Addr::UNSPECIFIED;
343345
/// assert_eq!(addr, Ipv4Addr::new(0, 0, 0, 0));
344346
/// ```
347+
#[doc(alias = "INADDR_ANY")]
345348
#[stable(feature = "ip_constructors", since = "1.30.0")]
346349
pub const UNSPECIFIED: Self = Ipv4Addr::new(0, 0, 0, 0);
347350

0 commit comments

Comments
 (0)