@@ -8,11 +8,15 @@ use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr};
8
8
/// as possibly some version-dependent additional information. See [`SocketAddrV4`]'s and
9
9
/// [`SocketAddrV6`]'s respective documentation for more details.
10
10
///
11
- /// The size of a `SocketAddr` instance may vary depending on the target operating
12
- /// system.
13
- ///
14
11
/// [IP address]: IpAddr
15
12
///
13
+ /// # Portability
14
+ ///
15
+ /// `SocketAddr` is intended to be a portable representation of socket addresses and is likely not
16
+ /// the same as the internal socket address type used by the target operating system's API. Like all
17
+ /// `repr(Rust)` structs, however, its exact layout remains undefined and should not be relied upon
18
+ /// between builds.
19
+ ///
16
20
/// # Examples
17
21
///
18
22
/// ```
@@ -42,13 +46,16 @@ pub enum SocketAddr {
42
46
///
43
47
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
44
48
///
45
- /// The size of a `SocketAddrV4` struct may vary depending on the target operating
46
- /// system. Do not assume that this type has the same memory layout as the underlying
47
- /// system representation.
48
- ///
49
49
/// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
50
50
/// [`IPv4` address]: Ipv4Addr
51
51
///
52
+ /// # Portability
53
+ ///
54
+ /// `SocketAddrV4` is intended to be a portable representation of socket addresses and is likely not
55
+ /// the same as the internal socket address type used by the target operating system's API. Like all
56
+ /// `repr(Rust)` structs, however, its exact layout remains undefined and should not be relied upon
57
+ /// between builds.
58
+ ///
52
59
/// # Textual representation
53
60
///
54
61
/// `SocketAddrV4` provides a [`FromStr`](crate::str::FromStr) implementation.
@@ -84,13 +91,16 @@ pub struct SocketAddrV4 {
84
91
///
85
92
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
86
93
///
87
- /// The size of a `SocketAddrV6` struct may vary depending on the target operating
88
- /// system. Do not assume that this type has the same memory layout as the underlying
89
- /// system representation.
90
- ///
91
94
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
92
95
/// [`IPv6` address]: Ipv6Addr
93
96
///
97
+ /// # Portability
98
+ ///
99
+ /// `SocketAddrV6` is intended to be a portable representation of socket addresses and is likely not
100
+ /// the same as the internal socket address type used by the target operating system's API. Like all
101
+ /// `repr(Rust)` structs, however, its exact layout remains undefined and should not be relied upon
102
+ /// between builds.
103
+ ///
94
104
/// # Textual representation
95
105
///
96
106
/// `SocketAddrV6` provides a [`FromStr`](crate::str::FromStr) implementation,
0 commit comments