Skip to content

Commit

Permalink
Improve libstd/net/udp.rs documentation.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nick Hamann committed Apr 29, 2015
1 parent 551a74d commit 42196ae
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub struct UdpSocket(net_imp::UdpSocket);
impl UdpSocket {
/// Creates a UDP socket from the given address.
///
/// Address type can be any implementor of `ToSocketAddr` trait. See its
/// documentation for concrete examples.
/// The address type can be any implementor of `ToSocketAddr` trait. See
/// its documentation for concrete examples.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<UdpSocket> {
super::each_addr(addr, net_imp::UdpSocket::bind).map(UdpSocket)
Expand All @@ -64,8 +64,8 @@ impl UdpSocket {
self.0.recv_from(buf)
}

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

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

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

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

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

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

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

0 comments on commit 42196ae

Please sign in to comment.