Skip to content

Fix a couple places in docs where try_send wasn't changed to send_opt #13610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libstd/comm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ impl<T: Send> Sender<T> {
/// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks!

pub fn send(&self, t: T) {
if self.send_opt(t).is_err() {
fail!("sending on a closed channel");
Expand Down Expand Up @@ -669,7 +669,7 @@ impl<T: Send> SyncSender<T> {

/// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this paragraph is a bit odd now that it's no longer talking about a neighboring function with the same name. Could you change the text to this?

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that bugged me too, but I wasn't sure what would be better. Changed it to use your text!

Expand Down