@@ -29,14 +29,14 @@ pub enum SseTransportError<E: std::error::Error + Send + Sync + 'static> {
2929 UnexpectedContentType ( Option < HeaderValue > ) ,
3030}
3131
32+ type SseStreamFuture < E > =
33+ BoxFuture < ' static , Result < BoxStream < ' static , Result < Sse , SseError > > , SseTransportError < E > > > ;
34+
3235enum SseTransportState < E : std:: error:: Error + Send + Sync + ' static > {
3336 Connected ( BoxStream < ' static , Result < Sse , SseError > > ) ,
3437 Retrying {
3538 times : usize ,
36- fut : BoxFuture <
37- ' static ,
38- Result < BoxStream < ' static , Result < Sse , SseError > > , SseTransportError < E > > ,
39- > ,
39+ fut : SseStreamFuture < E > ,
4040 } ,
4141 Fatal {
4242 reason : String ,
@@ -70,7 +70,7 @@ pub trait SseClient<E: std::error::Error + Send + Sync>: Clone + Send + Sync + '
7070 fn connect (
7171 & self ,
7272 last_event_id : Option < String > ,
73- ) -> BoxFuture < ' static , Result < BoxStream < ' static , Result < Sse , SseError > > , SseTransportError < E > > > ;
73+ ) -> SseStreamFuture < E > ;
7474
7575 fn post (
7676 & self ,
@@ -137,10 +137,7 @@ impl SseClient<reqwest::Error> for ReqwestSseClient {
137137 fn connect (
138138 & self ,
139139 last_event_id : Option < String > ,
140- ) -> BoxFuture <
141- ' static ,
142- Result < BoxStream < ' static , Result < Sse , SseError > > , SseTransportError < reqwest:: Error > > ,
143- > {
140+ ) -> SseStreamFuture < reqwest:: Error > {
144141 let client = self . http_client . clone ( ) ;
145142 let sse_url = self . sse_url . as_ref ( ) . to_string ( ) ;
146143 let last_event_id = last_event_id. clone ( ) ;
@@ -249,7 +246,7 @@ impl<C: SseClient<E>, E: std::error::Error + Send + Sync + 'static> SseTransport
249246
250247 fn retry_connection (
251248 & self ,
252- ) -> BoxFuture < ' static , Result < BoxStream < ' static , Result < Sse , SseError > > , SseTransportError < E > > >
249+ ) -> SseStreamFuture < E >
253250 {
254251 let retry_duration = {
255252 let recommended_retry_duration = self
0 commit comments