full working example for oneshot
A friend of mine was confused by the current example for oneshot channel.
I'm proposing more illustrative and *WORKING* version here ;)
@@ -82,22 +82,22 @@ struct Inner<T> {
///
/// ```
/// use futures::channel::oneshot;
-/// use futures::future::FutureExt;
-/// use std::thread;
+/// use std::{thread, time::Duration};
///
+/// fn main() {
/// let (sender, receiver) = oneshot::channel::<i32>();
///
-/// # let t =
/// thread::spawn(|| {
-/// let future = receiver.map(|i| {
-/// println!("got: {:?}", i);
-/// });
-/// // ...
-/// # return future;
+/// println!("THREAD: sleeping zzz...");
+/// thread::sleep(Duration::from_millis(2000));
+/// println!("THREAD: i'm awake! sending.");
+/// sender.send(3).unwrap();
/// });
///
-/// sender.send(3).unwrap();
-/// # futures::executor::block_on(t.join().unwrap());
+/// println!("MAIN: doing some useful stuff; and waiting...");
+///
+/// println!("MAIN: got: {:?}", futures::executor::block_on(receiver));
+/// }
/// ```
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
let inner = Arc::new(Inner::new());
