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.
This commit is contained in:
parent
551a74dddd
commit
42196ae7bf
1 changed files with 10 additions and 10 deletions
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue