11use std:: {
22 convert:: TryFrom ,
3- marker:: PhantomData ,
43 sync:: { Arc , RwLock , RwLockReadGuard , RwLockWriteGuard } ,
54 task:: { Context , Poll } ,
65} ;
7978 pub ( super ) shared : SharedStateRef ,
8079 conn : C ,
8180 control_send : C :: SendStream ,
82- control_recv : Option < FrameStream < C :: RecvStream > > ,
83- decoder_recv : Option < AcceptedRecvStream < C :: RecvStream > > ,
84- encoder_recv : Option < AcceptedRecvStream < C :: RecvStream > > ,
81+ control_recv : Option < FrameStream < C :: RecvStream , B > > ,
82+ decoder_recv : Option < AcceptedRecvStream < C :: RecvStream , B > > ,
83+ encoder_recv : Option < AcceptedRecvStream < C :: RecvStream , B > > ,
8584 pending_recv_streams : Vec < AcceptRecvStream < C :: RecvStream > > ,
8685 // The id of the last stream received by this connection:
8786 // request and push stream for server and clients respectively.
@@ -307,21 +306,23 @@ where
307306}
308307
309308pub struct RequestStream < S , B > {
310- pub ( super ) stream : S ,
309+ pub ( super ) stream : FrameStream < S , B > ,
311310 pub ( super ) trailers : Option < Bytes > ,
312311 pub ( super ) conn_state : SharedStateRef ,
313312 pub ( super ) max_field_section_size : u64 ,
314- _phantom_buffer : PhantomData < B > ,
315313}
316314
317315impl < S , B > RequestStream < S , B > {
318- pub fn new ( stream : S , max_field_section_size : u64 , conn_state : SharedStateRef ) -> Self {
316+ pub fn new (
317+ stream : FrameStream < S , B > ,
318+ max_field_section_size : u64 ,
319+ conn_state : SharedStateRef ,
320+ ) -> Self {
319321 Self {
320322 stream,
321323 conn_state,
322324 max_field_section_size,
323325 trailers : None ,
324- _phantom_buffer : PhantomData ,
325326 }
326327 }
327328}
@@ -332,7 +333,7 @@ impl<S, B> ConnectionState for RequestStream<S, B> {
332333 }
333334}
334335
335- impl < S , B > RequestStream < FrameStream < S > , B >
336+ impl < S , B > RequestStream < S , B >
336337where
337338 S : quic:: RecvStream ,
338339{
@@ -406,9 +407,9 @@ where
406407 }
407408}
408409
409- impl < S , B > RequestStream < FrameStream < S > , B >
410+ impl < S , B > RequestStream < S , B >
410411where
411- S : quic:: SendStream < B > + quic :: RecvStream ,
412+ S : quic:: SendStream < B > ,
412413 B : Buf ,
413414{
414415 /// Send some data on the response body.
@@ -449,3 +450,33 @@ where
449450 . map_err ( |e| self . maybe_conn_err ( e) )
450451 }
451452}
453+
454+ impl < S , B > RequestStream < S , B >
455+ where
456+ S : quic:: BidiStream < B > ,
457+ B : Buf ,
458+ {
459+ pub ( crate ) fn split (
460+ self ,
461+ ) -> (
462+ RequestStream < S :: SendStream , B > ,
463+ RequestStream < S :: RecvStream , B > ,
464+ ) {
465+ let ( send, recv) = self . stream . split ( ) ;
466+
467+ (
468+ RequestStream {
469+ stream : send,
470+ trailers : None ,
471+ conn_state : self . conn_state . clone ( ) ,
472+ max_field_section_size : 0 ,
473+ } ,
474+ RequestStream {
475+ stream : recv,
476+ trailers : self . trailers ,
477+ conn_state : self . conn_state ,
478+ max_field_section_size : self . max_field_section_size ,
479+ } ,
480+ )
481+ }
482+ }
0 commit comments