File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,20 @@ impl FromInner<c::sockaddr_in6> for SocketAddrV6 {
446
446
}
447
447
}
448
448
449
+ #[ stable( feature = "ip_from_ip" , since = "1.16.0" ) ]
450
+ impl From < SocketAddrV4 > for SocketAddr {
451
+ fn from ( sock4 : SocketAddrV4 ) -> SocketAddr {
452
+ SocketAddr :: V4 ( sock4)
453
+ }
454
+ }
455
+
456
+ #[ stable( feature = "ip_from_ip" , since = "1.16.0" ) ]
457
+ impl From < SocketAddrV6 > for SocketAddr {
458
+ fn from ( sock6 : SocketAddrV6 ) -> SocketAddr {
459
+ SocketAddr :: V6 ( sock6)
460
+ }
461
+ }
462
+
449
463
impl < ' a > IntoInner < ( * const c:: sockaddr , c:: socklen_t ) > for & ' a SocketAddr {
450
464
fn into_inner ( self ) -> ( * const c:: sockaddr , c:: socklen_t ) {
451
465
match * self {
Original file line number Diff line number Diff line change @@ -524,6 +524,20 @@ impl fmt::Display for IpAddr {
524
524
}
525
525
}
526
526
527
+ #[ stable( feature = "ip_from_ip" , since = "1.16.0" ) ]
528
+ impl From < Ipv4Addr > for IpAddr {
529
+ fn from ( ipv4 : Ipv4Addr ) -> IpAddr {
530
+ IpAddr :: V4 ( ipv4)
531
+ }
532
+ }
533
+
534
+ #[ stable( feature = "ip_from_ip" , since = "1.16.0" ) ]
535
+ impl From < Ipv6Addr > for IpAddr {
536
+ fn from ( ipv6 : Ipv6Addr ) -> IpAddr {
537
+ IpAddr :: V6 ( ipv6)
538
+ }
539
+ }
540
+
527
541
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
528
542
impl fmt:: Display for Ipv4Addr {
529
543
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
You can’t perform that action at this time.
0 commit comments