Skip to content

Commit 34802ca

Browse files
kachayevStjepan Glavina
authored and
Stjepan Glavina
committed
[docs] Make sure that "All Together" code compiles (#104)
Added missing `spawn_and_log_error` function declaration
1 parent 6d6328a commit 34802ca

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/src/tutorial/all_together.md

+12
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ async fn broker(mut events: Receiver<Event>) -> Result<()> {
125125
}
126126
Ok(())
127127
}
128+
129+
fn spawn_and_log_error<F>(fut: F) -> task::JoinHandle<()>
130+
where
131+
F: Future<Output = Result<()>> + Send + 'static,
132+
{
133+
task::spawn(async move {
134+
if let Err(e) = fut.await {
135+
eprintln!("{}", e)
136+
}
137+
})
138+
}
139+
128140
```
129141

130142
1. Inside the `server`, we create the broker's channel and `task`.

0 commit comments

Comments
 (0)