Skip to content

Commit 97e0803

Browse files
Nick Hamannsteveklabnik
Nick Hamann
authored andcommitted
Improve libstd/net/udp.rs documentation.
This adds some missing punctuation, adds a missing word, and corrects a bug in the description of `send_to`, which actually returns the number of bytes written on success. Fixes rust-lang#24925.
1 parent df42cbd commit 97e0803

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/libstd/net/udp.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ pub struct UdpSocket(net_imp::UdpSocket);
5050
impl UdpSocket {
5151
/// Creates a UDP socket from the given address.
5252
///
53-
/// Address type can be any implementor of `ToSocketAddr` trait. See its
54-
/// documentation for concrete examples.
53+
/// The address type can be any implementor of `ToSocketAddr` trait. See
54+
/// its documentation for concrete examples.
5555
#[stable(feature = "rust1", since = "1.0.0")]
5656
pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<UdpSocket> {
5757
super::each_addr(addr, net_imp::UdpSocket::bind).map(UdpSocket)
@@ -64,8 +64,8 @@ impl UdpSocket {
6464
self.0.recv_from(buf)
6565
}
6666

67-
/// Sends data on the socket to the given address. Returns nothing on
68-
/// success.
67+
/// Sends data on the socket to the given address. On success, returns the
68+
/// number of bytes written.
6969
///
7070
/// Address type can be any implementor of `ToSocketAddrs` trait. See its
7171
/// documentation for concrete examples.
@@ -95,34 +95,34 @@ impl UdpSocket {
9595
self.0.duplicate().map(UdpSocket)
9696
}
9797

98-
/// Sets the broadcast flag on or off
98+
/// Sets the broadcast flag on or off.
9999
pub fn set_broadcast(&self, on: bool) -> io::Result<()> {
100100
self.0.set_broadcast(on)
101101
}
102102

103-
/// Sets the multicast loop flag to the specified value
103+
/// Sets the multicast loop flag to the specified value.
104104
///
105105
/// This lets multicast packets loop back to local sockets (if enabled)
106106
pub fn set_multicast_loop(&self, on: bool) -> io::Result<()> {
107107
self.0.set_multicast_loop(on)
108108
}
109109

110-
/// Joins a multicast IP address (becomes a member of it)
110+
/// Joins a multicast IP address (becomes a member of it).
111111
pub fn join_multicast(&self, multi: &IpAddr) -> io::Result<()> {
112112
self.0.join_multicast(multi)
113113
}
114114

115-
/// Leaves a multicast IP address (drops membership from it)
115+
/// Leaves a multicast IP address (drops membership from it).
116116
pub fn leave_multicast(&self, multi: &IpAddr) -> io::Result<()> {
117117
self.0.leave_multicast(multi)
118118
}
119119

120-
/// Sets the multicast TTL
120+
/// Sets the multicast TTL.
121121
pub fn set_multicast_time_to_live(&self, ttl: i32) -> io::Result<()> {
122122
self.0.multicast_time_to_live(ttl)
123123
}
124124

125-
/// Sets this socket's TTL
125+
/// Sets this socket's TTL.
126126
pub fn set_time_to_live(&self, ttl: i32) -> io::Result<()> {
127127
self.0.time_to_live(ttl)
128128
}

0 commit comments

Comments
 (0)