Use tuple destructuring in chat example (#105)

This commit is contained in:
Grzegorz Baranski 2021-08-03 22:21:18 +02:00 committed by GitHub
parent 9a6bc4e962
commit 4e9b38ddf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,9 +44,10 @@ async fn main() {
.unwrap();
}
async fn websocket(stream: WebSocket, state: extract::Extension<Arc<AppState>>) {
let state = state.0;
async fn websocket(
stream: WebSocket,
extract::Extension(state): extract::Extension<Arc<AppState>>,
) {
// By splitting we can send and receive at the same time.
let (mut sender, mut receiver) = stream.split();