Skip to content

Commit

Permalink
Improve libstd/net/addr.rs documentation.
Browse files Browse the repository at this point in the history
This adds some missing punctuation and converts uses of "Gets" to
"Returns". This sounds better to my ear, but more importantly is
more consistent with the documentation from other files.
  • Loading branch information
Nick Hamann committed Apr 29, 2015
1 parent a237ceb commit 2baeabd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub enum SocketAddr {
#[stable(feature = "rust1", since = "1.0.0")]
pub struct SocketAddrV4 { inner: libc::sockaddr_in }

/// An IPv6 socket address
/// An IPv6 socket address.
#[derive(Copy)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct SocketAddrV6 { inner: libc::sockaddr_in6 }
Expand All @@ -56,7 +56,7 @@ impl SocketAddr {
}
}

/// Gets the IP address associated with this socket address.
/// Returns the IP address associated with this socket address.
#[unstable(feature = "ip_addr", reason = "recent addition")]
pub fn ip(&self) -> IpAddr {
match *self {
Expand All @@ -65,7 +65,7 @@ impl SocketAddr {
}
}

/// Gets the port number associated with this socket address
/// Returns the port number associated with this socket address.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn port(&self) -> u16 {
match *self {
Expand All @@ -89,15 +89,15 @@ impl SocketAddrV4 {
}
}

/// Gets the IP address associated with this socket address.
/// Returns the IP address associated with this socket address.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn ip(&self) -> &Ipv4Addr {
unsafe {
&*(&self.inner.sin_addr as *const libc::in_addr as *const Ipv4Addr)
}
}

/// Gets the port number associated with this socket address
/// Returns the port number associated with this socket address.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn port(&self) -> u16 { ntoh(self.inner.sin_port) }
}
Expand All @@ -120,24 +120,24 @@ impl SocketAddrV6 {
}
}

/// Gets the IP address associated with this socket address.
/// Returns the IP address associated with this socket address.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn ip(&self) -> &Ipv6Addr {
unsafe {
&*(&self.inner.sin6_addr as *const libc::in6_addr as *const Ipv6Addr)
}
}

/// Gets the port number associated with this socket address
/// Returns the port number associated with this socket address.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn port(&self) -> u16 { ntoh(self.inner.sin6_port) }

/// Gets scope ID associated with this address, corresponding to the
/// Returns scope ID associated with this address, corresponding to the
/// `sin6_flowinfo` field in C.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn flowinfo(&self) -> u32 { ntoh(self.inner.sin6_flowinfo) }

/// Gets scope ID associated with this address, corresponding to the
/// Returns scope ID associated with this address, corresponding to the
/// `sin6_scope_id` field in C.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn scope_id(&self) -> u32 { ntoh(self.inner.sin6_scope_id) }
Expand Down

0 comments on commit 2baeabd

Please sign in to comment.