File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -554,20 +554,28 @@ impl FromInner<c::sockaddr_in6> for SocketAddrV6 {
554554
555555#[ stable( feature = "ip_from_ip" , since = "1.16.0" ) ]
556556impl From < SocketAddrV4 > for SocketAddr {
557+ /// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
557558 fn from ( sock4 : SocketAddrV4 ) -> SocketAddr {
558559 SocketAddr :: V4 ( sock4)
559560 }
560561}
561562
562563#[ stable( feature = "ip_from_ip" , since = "1.16.0" ) ]
563564impl From < SocketAddrV6 > for SocketAddr {
565+ /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
564566 fn from ( sock6 : SocketAddrV6 ) -> SocketAddr {
565567 SocketAddr :: V6 ( sock6)
566568 }
567569}
568570
569571#[ stable( feature = "addr_from_into_ip" , since = "1.17.0" ) ]
570572impl < I : Into < IpAddr > > From < ( I , u16 ) > for SocketAddr {
573+ /// Converts a tuple struct (Into<[`IpAddr`]>, `u16`) into a [`SocketAddr`].
574+ ///
575+ /// This conversion creates a [`SocketAddr::V4`] for a [`IpAddr::V4`]
576+ /// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`].
577+ ///
578+ /// `u16` is treated as port of the newly created [`SocketAddr`].
571579 fn from ( pieces : ( I , u16 ) ) -> SocketAddr {
572580 SocketAddr :: new ( pieces. 0 . into ( ) , pieces. 1 )
573581 }
You can’t perform that action at this time.
0 commit comments