Skip to content

Commit 15cad1c

Browse files
committed
Move to intra doc links in std::net
1 parent b9db927 commit 15cad1c

File tree

6 files changed

+139
-293
lines changed

6 files changed

+139
-293
lines changed

library/std/src/net/addr.rs

+25-55
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ use crate::vec;
2222
/// The size of a `SocketAddr` instance may vary depending on the target operating
2323
/// system.
2424
///
25-
/// [IP address]: ../../std/net/enum.IpAddr.html
26-
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
27-
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
28-
///
2925
/// # Examples
3026
///
3127
/// ```
@@ -50,7 +46,7 @@ pub enum SocketAddr {
5046

5147
/// An IPv4 socket address.
5248
///
53-
/// IPv4 socket addresses consist of an [IPv4 address] and a 16-bit port number, as
49+
/// IPv4 socket addresses consist of an [`IPv4` address] and a 16-bit port number, as
5450
/// stated in [IETF RFC 793].
5551
///
5652
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
@@ -59,8 +55,7 @@ pub enum SocketAddr {
5955
/// system.
6056
///
6157
/// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
62-
/// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html
63-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
58+
/// [`IPv4` address]: Ipv4Addr
6459
///
6560
/// # Examples
6661
///
@@ -81,7 +76,7 @@ pub struct SocketAddrV4 {
8176

8277
/// An IPv6 socket address.
8378
///
84-
/// IPv6 socket addresses consist of an [Ipv6 address], a 16-bit port number, as well
79+
/// IPv6 socket addresses consist of an [`IPv6` address], a 16-bit port number, as well
8580
/// as fields containing the traffic class, the flow label, and a scope identifier
8681
/// (see [IETF RFC 2553, Section 3.3] for more details).
8782
///
@@ -91,8 +86,7 @@ pub struct SocketAddrV4 {
9186
/// system.
9287
///
9388
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
94-
/// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html
95-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
89+
/// [`IPv6` address]: Ipv6Addr
9690
///
9791
/// # Examples
9892
///
@@ -114,7 +108,7 @@ pub struct SocketAddrV6 {
114108
impl SocketAddr {
115109
/// Creates a new socket address from an [IP address] and a port number.
116110
///
117-
/// [IP address]: ../../std/net/enum.IpAddr.html
111+
/// [IP address]: IpAddr
118112
///
119113
/// # Examples
120114
///
@@ -210,12 +204,12 @@ impl SocketAddr {
210204
}
211205

212206
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
213-
/// [IPv4 address], and [`false`] otherwise.
207+
/// [`IPv4` address], and [`false`] otherwise.
214208
///
215-
/// [`true`]: ../../std/primitive.bool.html
209+
/// [IP address]: IpAddr
210+
/// [`IPv4` address]: IpAddr::V4
216211
/// [`false`]: ../../std/primitive.bool.html
217-
/// [IP address]: ../../std/net/enum.IpAddr.html
218-
/// [IPv4 address]: ../../std/net/enum.IpAddr.html#variant.V4
212+
/// [`true`]: ../../std/primitive.bool.html
219213
///
220214
/// # Examples
221215
///
@@ -232,12 +226,12 @@ impl SocketAddr {
232226
}
233227

234228
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
235-
/// [IPv6 address], and [`false`] otherwise.
229+
/// [`IPv6` address], and [`false`] otherwise.
236230
///
237-
/// [`true`]: ../../std/primitive.bool.html
231+
/// [IP address]: IpAddr
232+
/// [`IPv6` address]: IpAddr::V6
238233
/// [`false`]: ../../std/primitive.bool.html
239-
/// [IP address]: ../../std/net/enum.IpAddr.html
240-
/// [IPv6 address]: ../../std/net/enum.IpAddr.html#variant.V6
234+
/// [`true`]: ../../std/primitive.bool.html
241235
///
242236
/// # Examples
243237
///
@@ -255,9 +249,9 @@ impl SocketAddr {
255249
}
256250

257251
impl SocketAddrV4 {
258-
/// Creates a new socket address from an [IPv4 address] and a port number.
252+
/// Creates a new socket address from an [`IPv4` address] and a port number.
259253
///
260-
/// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html
254+
/// [`IPv4` address]: Ipv4Addr
261255
///
262256
/// # Examples
263257
///
@@ -342,14 +336,14 @@ impl SocketAddrV4 {
342336
}
343337

344338
impl SocketAddrV6 {
345-
/// Creates a new socket address from an [IPv6 address], a 16-bit port number,
339+
/// Creates a new socket address from an [`IPv6` address], a 16-bit port number,
346340
/// and the `flowinfo` and `scope_id` fields.
347341
///
348342
/// For more information on the meaning and layout of the `flowinfo` and `scope_id`
349343
/// parameters, see [IETF RFC 2553, Section 3.3].
350344
///
351345
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
352-
/// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html
346+
/// [`IPv6` address]: Ipv6Addr
353347
///
354348
/// # Examples
355349
///
@@ -461,9 +455,7 @@ impl SocketAddrV6 {
461455

462456
/// Changes the flow information associated with this socket address.
463457
///
464-
/// See the [`flowinfo`] method's documentation for more details.
465-
///
466-
/// [`flowinfo`]: #method.flowinfo
458+
/// See [`SocketAddrV6::flowinfo`]'s documentation for more details.
467459
///
468460
/// # Examples
469461
///
@@ -501,9 +493,7 @@ impl SocketAddrV6 {
501493

502494
/// Changes the scope ID associated with this socket address.
503495
///
504-
/// See the [`scope_id`] method's documentation for more details.
505-
///
506-
/// [`scope_id`]: #method.scope_id
496+
/// See [`SocketAddrV6::scope_id`]'s documentation for more details.
507497
///
508498
/// # Examples
509499
///
@@ -535,9 +525,6 @@ impl FromInner<c::sockaddr_in6> for SocketAddrV6 {
535525
#[stable(feature = "ip_from_ip", since = "1.16.0")]
536526
impl From<SocketAddrV4> for SocketAddr {
537527
/// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
538-
///
539-
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
540-
/// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
541528
fn from(sock4: SocketAddrV4) -> SocketAddr {
542529
SocketAddr::V4(sock4)
543530
}
@@ -546,9 +533,6 @@ impl From<SocketAddrV4> for SocketAddr {
546533
#[stable(feature = "ip_from_ip", since = "1.16.0")]
547534
impl From<SocketAddrV6> for SocketAddr {
548535
/// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
549-
///
550-
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
551-
/// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
552536
fn from(sock6: SocketAddrV6) -> SocketAddr {
553537
SocketAddr::V6(sock6)
554538
}
@@ -562,13 +546,6 @@ impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr {
562546
/// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`].
563547
///
564548
/// `u16` is treated as port of the newly created [`SocketAddr`].
565-
///
566-
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
567-
/// [`IpAddr::V4`]: ../../std/net/enum.IpAddr.html#variant.V4
568-
/// [`IpAddr::V6`]: ../../std/net/enum.IpAddr.html#variant.V6
569-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
570-
/// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
571-
/// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
572549
fn from(pieces: (I, u16)) -> SocketAddr {
573550
SocketAddr::new(pieces.0.into(), pieces.1)
574551
}
@@ -785,18 +762,11 @@ impl hash::Hash for SocketAddrV6 {
785762
/// Addresses returned by the operating system that are not IP addresses are
786763
/// silently ignored.
787764
///
788-
/// [`FromStr`]: ../../std/str/trait.FromStr.html
789-
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
790-
/// [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html
791-
/// [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html
792-
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
793-
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
794-
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
795-
/// [`&str`]: ../../std/primitive.str.html
796-
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html
797-
/// [`to_socket_addrs`]: #tymethod.to_socket_addrs
798-
/// [`UdpSocket`]: ../../std/net/struct.UdpSocket.html
799-
/// [`u16`]: ../../std/primitive.u16.html
765+
/// [`FromStr`]: crate::str::FromStr
766+
/// [`&str`]: str
767+
/// [`TcpStream`]: crate::net::TcpStream
768+
/// [`to_socket_addrs`]: ToSocketAddrs::to_socket_addrs
769+
/// [`UdpSocket`]: crate::net::UdpSocket
800770
///
801771
/// # Examples
802772
///
@@ -867,7 +837,7 @@ impl hash::Hash for SocketAddrV6 {
867837
/// let stream = TcpStream::connect((Ipv4Addr::new(127, 0, 0, 1), 443));
868838
/// ```
869839
///
870-
/// [`TcpStream::connect`]: ../../std/net/struct.TcpStream.html#method.connect
840+
/// [`TcpStream::connect`]: crate::net::TcpStream::connect
871841
#[stable(feature = "rust1", since = "1.0.0")]
872842
pub trait ToSocketAddrs {
873843
/// Returned iterator over socket addresses which this type may correspond

0 commit comments

Comments
 (0)