From 4e9b38ddf986ce596429ec73d9d77e1bc6738fb9 Mon Sep 17 00:00:00 2001 From: Grzegorz Baranski Date: Tue, 3 Aug 2021 22:21:18 +0200 Subject: [PATCH] Use tuple destructuring in chat example (#105) --- examples/chat.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/chat.rs b/examples/chat.rs index fdf7246b..fa0d90be 100644 --- a/examples/chat.rs +++ b/examples/chat.rs @@ -44,9 +44,10 @@ async fn main() { .unwrap(); } -async fn websocket(stream: WebSocket, state: extract::Extension>) { - let state = state.0; - +async fn websocket( + stream: WebSocket, + extract::Extension(state): extract::Extension>, +) { // By splitting we can send and receive at the same time. let (mut sender, mut receiver) = stream.split();