-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Changes from 1 commit
5a6ebdf
89c35ae
ae8ba78
dab8e81
ab4f442
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
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(); | ||
/// 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and one above here |
||
/// println!("Got: {}", x); | ||
|
There was a problem hiding this comment.
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