@@ -100,15 +100,6 @@ const WANT_PENDING: usize = 1;
100100const WANT_READY : usize = 2 ;
101101
102102impl Incoming {
103- /// Create a `Body` stream with an associated sender half.
104- ///
105- /// Useful when wanting to stream chunks from another thread.
106- #[ inline]
107- #[ cfg( test) ]
108- pub ( crate ) fn channel ( ) -> ( Sender , Incoming ) {
109- Self :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false )
110- }
111-
112103 #[ cfg( all( feature = "http1" , any( feature = "client" , feature = "server" ) ) ) ]
113104 pub ( crate ) fn new_channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
114105 let ( data_tx, data_rx) = mpsc:: channel ( 0 ) ;
@@ -482,7 +473,11 @@ mod tests {
482473
483474 eq ( Incoming :: empty ( ) , SizeHint :: with_exact ( 0 ) , "empty" ) ;
484475
485- eq ( Incoming :: channel ( ) . 1 , SizeHint :: new ( ) , "channel" ) ;
476+ eq (
477+ Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) . 1 ,
478+ SizeHint :: new ( ) ,
479+ "channel" ,
480+ ) ;
486481
487482 eq (
488483 Incoming :: new_channel ( DecodedLength :: new ( 4 ) , /*wanter =*/ false ) . 1 ,
@@ -494,7 +489,7 @@ mod tests {
494489 #[ cfg( not( miri) ) ]
495490 #[ tokio:: test]
496491 async fn channel_abort ( ) {
497- let ( tx, mut rx) = Incoming :: channel ( ) ;
492+ let ( tx, mut rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
498493
499494 tx. abort ( ) ;
500495
@@ -505,7 +500,8 @@ mod tests {
505500 #[ cfg( all( not( miri) , feature = "http1" ) ) ]
506501 #[ tokio:: test]
507502 async fn channel_abort_when_buffer_is_full ( ) {
508- let ( mut tx, mut rx) = Incoming :: channel ( ) ;
503+ let ( mut tx, mut rx) =
504+ Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
509505
510506 tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
511507 // buffer is full, but can still send abort
@@ -527,7 +523,7 @@ mod tests {
527523 #[ cfg( feature = "http1" ) ]
528524 #[ test]
529525 fn channel_buffers_one ( ) {
530- let ( mut tx, _rx) = Incoming :: channel ( ) ;
526+ let ( mut tx, _rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
531527
532528 tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
533529
@@ -539,7 +535,7 @@ mod tests {
539535 #[ cfg( not( miri) ) ]
540536 #[ tokio:: test]
541537 async fn channel_empty ( ) {
542- let ( _, mut rx) = Incoming :: channel ( ) ;
538+ let ( _, mut rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
543539
544540 assert ! ( rx. frame( ) . await . is_none( ) ) ;
545541 }
0 commit comments