Skip to content
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

Add links and some examples to std::sync::mpsc docs #40981

Merged
merged 5 commits into from
Apr 5, 2017
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
Prev Previous commit
Next Next commit
Fix warnings in examples
  • Loading branch information
Technius committed Apr 1, 2017
commit dab8e8121f4a2ba6322417ba7644f3a06973a785
18 changes: 9 additions & 9 deletions src/libstd/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
@@ -312,13 +312,13 @@ mod spsc_queue;
/// use std::time::Duration;
/// let (send, recv) = channel();
Copy link
Member

Choose a reason for hiding this comment

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

could you add a blank line above and below this one? just the ///s

/// thread::spawn(move || {
/// send.send("Hello world!");
/// send.send("Hello world!").unwrap();
/// thread::sleep(Duration::from_secs(2)); // block for two seconds
/// send.send("Delayed for 2 seconds");
/// send.send("Delayed for 2 seconds").unwrap();
/// });
/// println!("{:?}", recv.recv()); // Received immediately
/// println!("{}", recv.recv().unwrap()); // Received immediately
Copy link
Member

Choose a reason for hiding this comment

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

same here, only one above please!

/// println!("Waiting...");
/// println!("{:?}", recv.recv()); // Received after 2 seconds
/// println!("{}", recv.recv().unwrap()); // Received after 2 seconds
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Receiver<T> {
@@ -388,11 +388,11 @@ pub struct IntoIter<T> {
/// let sender2 = sender.clone();
Copy link
Member

Choose a reason for hiding this comment

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

and below this one?

/// // First thread owns sender
/// thread::spawn(move || {
/// sender.send(1);
/// sender.send(1).unwrap();
/// });
/// // Second thread owns sender2
Copy link
Member

Choose a reason for hiding this comment

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

and one above here

/// thread::spawn(move || {
/// sender2.send(2);
/// sender2.send(2).unwrap();
/// });
/// let msg = receiver.recv().unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

and one above here

/// let msg2 = receiver.recv().unwrap();
@@ -1099,9 +1099,9 @@ impl<T> Receiver<T> {
/// use std::thread;
/// let (send, recv) = channel();
Copy link
Member

Choose a reason for hiding this comment

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

one blank line above and below this line, please!

/// thread::spawn(move || {
/// send.send(1u8);
/// send.send(2u8);
/// send.send(3u8);
/// send.send(1u8).unwrap();
/// send.send(2u8).unwrap();
/// send.send(3u8).unwrap();
/// });
/// for x in recv.iter() {
Copy link
Member

Choose a reason for hiding this comment

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

and one above here

/// println!("Got: {}", x);