File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -656,6 +656,13 @@ impl From<[u8; 4]> for Ipv4Addr {
656
656
}
657
657
}
658
658
659
+ #[ stable( feature = "ip_from_slice" , since = "1.17.0" ) ]
660
+ impl From < [ u8 ; 4 ] > for IpAddr {
661
+ fn from ( octets : [ u8 ; 4 ] ) -> IpAddr {
662
+ IpAddr :: V4 ( Ipv4Addr :: from ( octets) )
663
+ }
664
+ }
665
+
659
666
impl Ipv6Addr {
660
667
/// Creates a new IPv6 address from eight 16-bit segments.
661
668
///
@@ -1166,6 +1173,21 @@ impl From<[u16; 8]> for Ipv6Addr {
1166
1173
}
1167
1174
}
1168
1175
1176
+
1177
+ #[ stable( feature = "ip_from_slice" , since = "1.17.0" ) ]
1178
+ impl From < [ u8 ; 16 ] > for IpAddr {
1179
+ fn from ( octets : [ u8 ; 16 ] ) -> IpAddr {
1180
+ IpAddr :: V6 ( Ipv6Addr :: from ( octets) )
1181
+ }
1182
+ }
1183
+
1184
+ #[ stable( feature = "ip_from_slice" , since = "1.17.0" ) ]
1185
+ impl From < [ u16 ; 8 ] > for IpAddr {
1186
+ fn from ( octets : [ u16 ; 8 ] ) -> IpAddr {
1187
+ IpAddr :: V6 ( Ipv6Addr :: from ( octets) )
1188
+ }
1189
+ }
1190
+
1169
1191
// Tests for this module
1170
1192
#[ cfg( all( test, not( target_os = "emscripten" ) ) ) ]
1171
1193
mod tests {
You can’t perform that action at this time.
0 commit comments