From 42196ae7bf3dd7eac099f0ef850f067d07506864 Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Wed, 29 Apr 2015 15:57:17 -0500 Subject: [PATCH] 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 #24925. --- src/libstd/net/udp.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index 1955b895300ea..0b04ecb1b7228 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -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(addr: A) -> io::Result { super::each_addr(addr, net_imp::UdpSocket::bind).map(UdpSocket) @@ -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. @@ -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) }