From fa64965d6920700c0770dd76cb32aad382cc9d4e Mon Sep 17 00:00:00 2001 From: James Sanders Date: Fri, 18 Apr 2014 17:40:34 -0600 Subject: [PATCH 1/2] Fix a couple places in docs where try_send wasn't changed to send_opt --- src/libstd/comm/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 7700000b8693c..901a9051d0aca 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -479,7 +479,7 @@ impl Sender { /// then the other end could immediately disconnect. /// /// The purpose of this functionality is to propagate failure among tasks. - /// If failure is not desired, then consider using the `try_send` method + /// If failure is not desired, then consider using the `send_opt` method pub fn send(&self, t: T) { if self.send_opt(t).is_err() { fail!("sending on a closed channel"); @@ -669,7 +669,7 @@ impl SyncSender { /// Attempts to send a value on this channel without blocking. /// - /// This method semantically differs from `Sender::try_send` because it can + /// This method semantically differs from `Sender::send_opt` because it can /// fail if the receiver has not disconnected yet. If the buffer on this /// channel is full, this function will immediately return the data back to /// the callee. From 29c291bb1b8cde76c022372b2f60df6db8d92e63 Mon Sep 17 00:00:00 2001 From: James Sanders Date: Sat, 19 Apr 2014 10:23:15 -0600 Subject: [PATCH 2/2] Rewrite paragraph describing difference between try_send and send_opt --- src/libstd/comm/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 901a9051d0aca..ce1c09af07cad 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -669,10 +669,10 @@ impl SyncSender { /// Attempts to send a value on this channel without blocking. /// - /// This method semantically differs from `Sender::send_opt` because it can - /// fail if the receiver has not disconnected yet. If the buffer on this - /// channel is full, this function will immediately return the data back to - /// the callee. + /// This method differs from `send_opt` by returning immediately if the + /// channel's buffer is full or no receiver is waiting to acquire some + /// data. Compared with `send_opt`, this function has two failure cases + /// instead of one (one for disconnection, one for a full buffer). /// /// See `SyncSender::send` for notes about guarantees of whether the /// receiver has received the data or not if this function is successful.