File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1272,6 +1272,22 @@ impl From<[u8; 4]> for IpAddr {
1272
1272
}
1273
1273
}
1274
1274
1275
+ #[ stable( feature = "ip_as_ref" , since = "CURRENT_RUSTC_VERSION" ) ]
1276
+ impl AsRef < [ u8 ] > for IpAddr {
1277
+ #[ inline]
1278
+ fn as_ref ( & self ) -> & [ u8 ] {
1279
+ self . as_slice ( )
1280
+ }
1281
+ }
1282
+
1283
+ #[ stable( feature = "ip_as_ref" , since = "CURRENT_RUSTC_VERSION" ) ]
1284
+ impl AsRef < [ u8 ] > for Ipv4Addr {
1285
+ #[ inline]
1286
+ fn as_ref ( & self ) -> & [ u8 ] {
1287
+ self . as_slice ( )
1288
+ }
1289
+ }
1290
+
1275
1291
impl Ipv6Addr {
1276
1292
/// Creates a new IPv6 address from eight 16-bit segments.
1277
1293
///
@@ -2332,6 +2348,14 @@ impl From<[u16; 8]> for IpAddr {
2332
2348
}
2333
2349
}
2334
2350
2351
+ #[ stable( feature = "ip_as_ref" , since = "CURRENT_RUSTC_VERSION" ) ]
2352
+ impl AsRef < [ u8 ] > for Ipv6Addr {
2353
+ #[ inline]
2354
+ fn as_ref ( & self ) -> & [ u8 ] {
2355
+ self . as_slice ( )
2356
+ }
2357
+ }
2358
+
2335
2359
#[ stable( feature = "ip_bitops" , since = "1.75.0" ) ]
2336
2360
impl Not for Ipv4Addr {
2337
2361
type Output = Ipv4Addr ;
You can’t perform that action at this time.
0 commit comments