diff --git a/docs/src/tutorial/all_together.md b/docs/src/tutorial/all_together.md index 64fba71..74c6987 100644 --- a/docs/src/tutorial/all_together.md +++ b/docs/src/tutorial/all_together.md @@ -125,6 +125,18 @@ async fn broker(mut events: Receiver) -> Result<()> { } Ok(()) } + +fn spawn_and_log_error(fut: F) -> task::JoinHandle<()> +where + F: Future> + Send + 'static, +{ + task::spawn(async move { + if let Err(e) = fut.await { + eprintln!("{}", e) + } + }) +} + ``` 1. Inside the `server`, we create the broker's channel and `task`.