mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-22 07:08:16 +01:00
Use tuple destructuring in chat example (#105)
This commit is contained in:
parent
9a6bc4e962
commit
4e9b38ddf9
1 changed files with 4 additions and 3 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue