Skip to content

Commit b8cbc5d

Browse files
committed
Addressed requested changes for PR #40838
* Fixed spelling ToSocketAddr -> ToSocketAddrs in module docs (which also fixes a link) * Added missing "when" before "interacting" in module docs * Changed SocketAddr's top-level docs to explicitly state what socket addresses consist of, making them more consistent with SocketAddrV4's and SocketAddrV6's docs * Changed "in C" -> "in C's `netinet/in.h`" * Changed wording in is_ipv4/is_ipv6 methods to ", `false` otherwise" * Add missing closing ` ``` ` in Ipv6Addr's examples * Removed "Errors" section in ToSocketAddrs' to_socket_addrs method as it was rather redundant
1 parent c2601fd commit b8cbc5d

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

src/libstd/net/addr.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ use slice;
2222

2323
/// An internet socket address, either IPv4 or IPv6.
2424
///
25-
/// This enum can contain either an [`SocketAddrV4`] or an [`SocketAddrV6`]. see their
26-
/// respective documentation for more details.
25+
/// Internet socket addresses consist of an [IP address], a 16-bit port number, as well
26+
/// as possibly some version-dependent additional information. See [`SocketAddrV4`]'s and
27+
/// [`SocketAddrV6`]'s respective documentation for more details.
2728
///
29+
/// [IP address]: ../../std/net/enum.IpAddr.html
2830
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
2931
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
3032
///
@@ -202,13 +204,12 @@ impl SocketAddr {
202204
}
203205

204206
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
205-
/// [IPv4 address] and [`false`] if it's an [IPv6 address].
207+
/// [IPv4 address], and [`false`] otherwise.
206208
///
207209
/// [`true`]: ../../std/primitive.bool.html
208210
/// [`false`]: ../../std/primitive.bool.html
209211
/// [IP address]: ../../std/net/enum.IpAddr.html
210212
/// [IPv4 address]: ../../std/net/enum.IpAddr.html#variant.V4
211-
/// [IPv6 address]: ../../std/net/enum.IpAddr.html#variant.V6
212213
///
213214
/// # Examples
214215
///
@@ -230,12 +231,11 @@ impl SocketAddr {
230231
}
231232

232233
/// Returns [`true`] if the [IP address] in this `SocketAddr` is an
233-
/// [IPv6 address] and [`false`] if it's an [IPv4 address].
234+
/// [IPv6 address], and [`false`] otherwise.
234235
///
235236
/// [`true`]: ../../std/primitive.bool.html
236237
/// [`false`]: ../../std/primitive.bool.html
237238
/// [IP address]: ../../std/net/enum.IpAddr.html
238-
/// [IPv4 address]: ../../std/net/enum.IpAddr.html#variant.V4
239239
/// [IPv6 address]: ../../std/net/enum.IpAddr.html#variant.V6
240240
///
241241
/// # Examples
@@ -446,10 +446,10 @@ impl SocketAddrV6 {
446446

447447
/// Returns the flow information associated with this address.
448448
///
449-
/// This information corresponds to the `sin6_flowinfo` field in C, as specified in
450-
/// [IETF RFC 2553, Section 3.3]. It combines information about the flow label and
451-
/// the traffic class as specified in [IETF RFC 2460], respectively [Section 6] and
452-
/// [Section 7].
449+
/// This information corresponds to the `sin6_flowinfo` field in C's `netinet/in.h`,
450+
/// as specified in [IETF RFC 2553, Section 3.3].
451+
/// It combines information about the flow label and the traffic class as specified
452+
/// in [IETF RFC 2460], respectively [Section 6] and [Section 7].
453453
///
454454
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
455455
/// [IETF RFC 2460]: https://tools.ietf.org/html/rfc2460
@@ -491,8 +491,8 @@ impl SocketAddrV6 {
491491

492492
/// Returns the scope ID associated with this address.
493493
///
494-
/// This information corresponds to the `sin6_scope_id` field in C, as specified in
495-
/// [IETF RFC 2553, Section 3.3].
494+
/// This information corresponds to the `sin6_scope_id` field in C's `netinet/in.h`,
495+
/// as specified in [IETF RFC 2553, Section 3.3].
496496
///
497497
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
498498
///
@@ -743,12 +743,6 @@ pub trait ToSocketAddrs {
743743
///
744744
/// Note that this function may block the current thread while resolution is
745745
/// performed.
746-
///
747-
/// # Errors
748-
///
749-
/// Any errors encountered during resolution will be returned as an [`Err`].
750-
///
751-
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
752746
#[stable(feature = "rust1", since = "1.0.0")]
753747
fn to_socket_addrs(&self) -> io::Result<Self::Iter>;
754748
}

src/libstd/net/ip.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ pub struct Ipv4Addr {
114114
/// let localhost = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
115115
/// assert_eq!("::1".parse(), Ok(localhost));
116116
/// assert_eq!(localhost.is_loopback(), true);
117+
/// ```
117118
#[derive(Copy)]
118119
#[stable(feature = "rust1", since = "1.0.0")]
119120
pub struct Ipv6Addr {
@@ -266,13 +267,11 @@ impl IpAddr {
266267
}
267268
}
268269

269-
/// Returns [`true`] if this address is an [IPv4 address] and [`false`] if it's an
270-
/// [IPv6 address].
270+
/// Returns [`true`] if this address is an [IPv4 address], and [`false`] otherwise.
271271
///
272272
/// [`true`]: ../../std/primitive.bool.html
273273
/// [`false`]: ../../std/primitive.bool.html
274274
/// [IPv4 address]: #variant.V4
275-
/// [IPv6 address]: #variant.V6
276275
///
277276
/// # Examples
278277
///
@@ -293,12 +292,10 @@ impl IpAddr {
293292
}
294293
}
295294

296-
/// Returns [`true`] if this address is an [IPv6 address] and [`false`] if it's an
297-
/// [IPv4 address].
295+
/// Returns [`true`] if this address is an [IPv6 address], and [`false`] otherwise.
298296
///
299297
/// [`true`]: ../../std/primitive.bool.html
300298
/// [`false`]: ../../std/primitive.bool.html
301-
/// [IPv4 address]: #variant.V4
302299
/// [IPv6 address]: #variant.V6
303300
///
304301
/// # Examples

src/libstd/net/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//! [`Ipv6Addr`] are respectively IPv4 and IPv6 addresses
2222
//! * [`SocketAddr`] represents socket addresses of either IPv4 or IPv6; [`SocketAddrV4`]
2323
//! and [`SocketAddrV6`] are respectively IPv4 and IPv6 socket addresses
24-
//! * [`ToSocketAddr`] is a trait that used for generic address resolution interacting
24+
//! * [`ToSocketAddrs`] is a trait that used for generic address resolution when interacting
2525
//! with networking objects like [`TcpListener`], [`TcpStream`] or [`UdpSocket`]
2626
//! * Other types are return or parameter types for various methods in this module
2727
//!
@@ -33,7 +33,7 @@
3333
//! [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
3434
//! [`TcpListener`]: ../../std/net/struct.TcpListener.html
3535
//! [`TcpStream`]: ../../std/net/struct.TcpStream.html
36-
//! [`ToSocketAddr`]: ../../std/net/trait.ToSocketAddr.html
36+
//! [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html
3737
//! [`UdpSocket`]: ../../std/net/struct.UdpSocket.html
3838
3939
#![stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)