about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/net/socket_addr.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/library/core/src/net/socket_addr.rs b/library/core/src/net/socket_addr.rs
index 2d48e271580..8396aecf947 100644
--- a/library/core/src/net/socket_addr.rs
+++ b/library/core/src/net/socket_addr.rs
@@ -122,6 +122,7 @@ impl SocketAddr {
     #[stable(feature = "ip_addr", since = "1.7.0")]
     #[must_use]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn new(ip: IpAddr, port: u16) -> SocketAddr {
         match ip {
             IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
@@ -142,6 +143,7 @@ impl SocketAddr {
     #[must_use]
     #[stable(feature = "ip_addr", since = "1.7.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn ip(&self) -> IpAddr {
         match *self {
             SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
@@ -161,6 +163,7 @@ impl SocketAddr {
     /// assert_eq!(socket.ip(), IpAddr::V4(Ipv4Addr::new(10, 10, 0, 1)));
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_ip(&mut self, new_ip: IpAddr) {
         // `match (*self, new_ip)` would have us mutate a copy of self only to throw it away.
         match (self, new_ip) {
@@ -183,6 +186,7 @@ impl SocketAddr {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn port(&self) -> u16 {
         match *self {
             SocketAddr::V4(ref a) => a.port(),
@@ -202,6 +206,7 @@ impl SocketAddr {
     /// assert_eq!(socket.port(), 1025);
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_port(&mut self, new_port: u16) {
         match *self {
             SocketAddr::V4(ref mut a) => a.set_port(new_port),
@@ -227,6 +232,7 @@ impl SocketAddr {
     #[must_use]
     #[stable(feature = "sockaddr_checker", since = "1.16.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn is_ipv4(&self) -> bool {
         matches!(*self, SocketAddr::V4(_))
     }
@@ -249,6 +255,7 @@ impl SocketAddr {
     #[must_use]
     #[stable(feature = "sockaddr_checker", since = "1.16.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn is_ipv6(&self) -> bool {
         matches!(*self, SocketAddr::V6(_))
     }
@@ -269,6 +276,7 @@ impl SocketAddrV4 {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
         SocketAddrV4 { ip, port }
     }
@@ -286,6 +294,7 @@ impl SocketAddrV4 {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn ip(&self) -> &Ipv4Addr {
         &self.ip
     }
@@ -302,6 +311,7 @@ impl SocketAddrV4 {
     /// assert_eq!(socket.ip(), &Ipv4Addr::new(192, 168, 0, 1));
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_ip(&mut self, new_ip: Ipv4Addr) {
         self.ip = new_ip;
     }
@@ -319,6 +329,7 @@ impl SocketAddrV4 {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn port(&self) -> u16 {
         self.port
     }
@@ -335,6 +346,7 @@ impl SocketAddrV4 {
     /// assert_eq!(socket.port(), 4242);
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_port(&mut self, new_port: u16) {
         self.port = new_port;
     }
@@ -360,6 +372,7 @@ impl SocketAddrV6 {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
         SocketAddrV6 { ip, port, flowinfo, scope_id }
     }
@@ -377,6 +390,7 @@ impl SocketAddrV6 {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn ip(&self) -> &Ipv6Addr {
         &self.ip
     }
@@ -393,6 +407,7 @@ impl SocketAddrV6 {
     /// assert_eq!(socket.ip(), &Ipv6Addr::new(76, 45, 0, 0, 0, 0, 0, 0));
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_ip(&mut self, new_ip: Ipv6Addr) {
         self.ip = new_ip;
     }
@@ -410,6 +425,7 @@ impl SocketAddrV6 {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn port(&self) -> u16 {
         self.port
     }
@@ -426,6 +442,7 @@ impl SocketAddrV6 {
     /// assert_eq!(socket.port(), 4242);
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_port(&mut self, new_port: u16) {
         self.port = new_port;
     }
@@ -453,6 +470,7 @@ impl SocketAddrV6 {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn flowinfo(&self) -> u32 {
         self.flowinfo
     }
@@ -471,6 +489,7 @@ impl SocketAddrV6 {
     /// assert_eq!(socket.flowinfo(), 56);
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
         self.flowinfo = new_flowinfo;
     }
@@ -493,6 +512,7 @@ impl SocketAddrV6 {
     #[must_use]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_const_stable(feature = "const_socketaddr", since = "1.69.0")]
+    #[inline]
     pub const fn scope_id(&self) -> u32 {
         self.scope_id
     }
@@ -511,6 +531,7 @@ impl SocketAddrV6 {
     /// assert_eq!(socket.scope_id(), 42);
     /// ```
     #[stable(feature = "sockaddr_setters", since = "1.9.0")]
+    #[inline]
     pub fn set_scope_id(&mut self, new_scope_id: u32) {
         self.scope_id = new_scope_id;
     }
@@ -519,6 +540,7 @@ impl SocketAddrV6 {
 #[stable(feature = "ip_from_ip", since = "1.16.0")]
 impl From<SocketAddrV4> for SocketAddr {
     /// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
+    #[inline]
     fn from(sock4: SocketAddrV4) -> SocketAddr {
         SocketAddr::V4(sock4)
     }
@@ -527,6 +549,7 @@ impl From<SocketAddrV4> for SocketAddr {
 #[stable(feature = "ip_from_ip", since = "1.16.0")]
 impl From<SocketAddrV6> for SocketAddr {
     /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
+    #[inline]
     fn from(sock6: SocketAddrV6) -> SocketAddr {
         SocketAddr::V6(sock6)
     }
@@ -624,6 +647,7 @@ impl fmt::Debug for SocketAddrV6 {
 
 #[stable(feature = "socketaddr_ordering", since = "1.45.0")]
 impl PartialOrd for SocketAddrV4 {
+    #[inline]
     fn partial_cmp(&self, other: &SocketAddrV4) -> Option<Ordering> {
         Some(self.cmp(other))
     }
@@ -631,6 +655,7 @@ impl PartialOrd for SocketAddrV4 {
 
 #[stable(feature = "socketaddr_ordering", since = "1.45.0")]
 impl PartialOrd for SocketAddrV6 {
+    #[inline]
     fn partial_cmp(&self, other: &SocketAddrV6) -> Option<Ordering> {
         Some(self.cmp(other))
     }
@@ -638,6 +663,7 @@ impl PartialOrd for SocketAddrV6 {
 
 #[stable(feature = "socketaddr_ordering", since = "1.45.0")]
 impl Ord for SocketAddrV4 {
+    #[inline]
     fn cmp(&self, other: &SocketAddrV4) -> Ordering {
         self.ip().cmp(other.ip()).then(self.port().cmp(&other.port()))
     }
@@ -645,6 +671,7 @@ impl Ord for SocketAddrV4 {
 
 #[stable(feature = "socketaddr_ordering", since = "1.45.0")]
 impl Ord for SocketAddrV6 {
+    #[inline]
     fn cmp(&self, other: &SocketAddrV6) -> Ordering {
         self.ip().cmp(other.ip()).then(self.port().cmp(&other.port()))
     }