@@ -385,6 +385,22 @@ impl Ipv4Addr {
385
385
issue = "44582" ) ]
386
386
pub const UNSPECIFIED : Self = Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) ;
387
387
388
+ /// An IPv4 address representing the broadcast address: 255.255.255.255
389
+ ///
390
+ /// # Examples
391
+ ///
392
+ /// ```
393
+ /// #![feature(ip_constructors)]
394
+ /// use std::net::Ipv4Addr;
395
+ ///
396
+ /// let addr = Ipv4Addr::BROADCAST;
397
+ /// assert_eq!(addr, Ipv4Addr::new(255, 255, 255, 255));
398
+ /// ```
399
+ #[ unstable( feature = "ip_constructors" ,
400
+ reason = "requires greater scrutiny before stabilization" ,
401
+ issue = "44582" ) ]
402
+ pub const BROADCAST : Self = Ipv4Addr :: new ( 255 , 255 , 255 , 255 ) ;
403
+
388
404
/// Returns the four eight-bit integers that make up this address.
389
405
///
390
406
/// # Examples
@@ -1850,6 +1866,8 @@ mod tests {
1850
1866
assert ! ( Ipv4Addr :: LOCALHOST . is_loopback( ) ) ;
1851
1867
assert_eq ! ( Ipv4Addr :: UNSPECIFIED , Ipv4Addr :: new( 0 , 0 , 0 , 0 ) ) ;
1852
1868
assert ! ( Ipv4Addr :: UNSPECIFIED . is_unspecified( ) ) ;
1869
+ assert_eq ! ( Ipv4Addr :: BROADCAST , Ipv4Addr :: new( 255 , 255 , 255 , 255 ) ) ;
1870
+ assert ! ( Ipv4Addr :: BROADCAST . is_broadcast( ) ) ;
1853
1871
}
1854
1872
1855
1873
#[ test]
0 commit comments