replace qualified path with use

main
Zynh0722 2023-11-06 12:14:50 -08:00
parent dfce42fd03
commit 239b332b48
1 changed files with 6 additions and 4 deletions

View File

@ -17,7 +17,10 @@ use diesel::{ExpressionMethods, OptionalExtension, QueryDsl, SelectableHelper};
use diesel_async::{scoped_futures::ScopedFutureExt, AsyncConnection, RunQueryDsl}; use diesel_async::{scoped_futures::ScopedFutureExt, AsyncConnection, RunQueryDsl};
use futures_util::Stream; use futures_util::Stream;
use serde::Deserialize; use serde::Deserialize;
use tokio_stream::{wrappers::errors::BroadcastStreamRecvError, StreamExt as _}; use tokio_stream::{
wrappers::{errors::BroadcastStreamRecvError, BroadcastStream},
StreamExt as _,
};
use crate::AppState; use crate::AppState;
@ -178,9 +181,8 @@ async fn add_dancer(
async fn ada_subscribe( async fn ada_subscribe(
State(state): State<AppState>, State(state): State<AppState>,
) -> Sse<impl Stream<Item = Result<Event, BroadcastStreamRecvError>>> { ) -> Sse<impl Stream<Item = Result<Event, BroadcastStreamRecvError>>> {
let stream = let stream = BroadcastStream::new(state.sse_handler.ada_sender.subscribe())
tokio_stream::wrappers::BroadcastStream::new(state.sse_handler.ada_sender.subscribe()) .map(|r| r.map(|s| Event::default().event("ada").data(s)));
.map(|r| r.map(|s| Event::default().event("ada").data(s)));
Sse::new(stream).keep_alive(KeepAlive::default()) Sse::new(stream).keep_alive(KeepAlive::default())
} }