@@ -100,15 +100,6 @@ const WANT_PENDING: usize = 1;
100
100
const WANT_READY : usize = 2 ;
101
101
102
102
impl 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
-
112
103
#[ cfg( all( feature = "http1" , any( feature = "client" , feature = "server" ) ) ) ]
113
104
pub ( crate ) fn new_channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
114
105
let ( data_tx, data_rx) = mpsc:: channel ( 0 ) ;
@@ -482,7 +473,11 @@ mod tests {
482
473
483
474
eq ( Incoming :: empty ( ) , SizeHint :: with_exact ( 0 ) , "empty" ) ;
484
475
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
+ ) ;
486
481
487
482
eq (
488
483
Incoming :: new_channel ( DecodedLength :: new ( 4 ) , /*wanter =*/ false ) . 1 ,
@@ -494,7 +489,7 @@ mod tests {
494
489
#[ cfg( not( miri) ) ]
495
490
#[ tokio:: test]
496
491
async fn channel_abort ( ) {
497
- let ( tx, mut rx) = Incoming :: channel ( ) ;
492
+ let ( tx, mut rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
498
493
499
494
tx. abort ( ) ;
500
495
@@ -505,7 +500,8 @@ mod tests {
505
500
#[ cfg( all( not( miri) , feature = "http1" ) ) ]
506
501
#[ tokio:: test]
507
502
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 ) ;
509
505
510
506
tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
511
507
// buffer is full, but can still send abort
@@ -527,7 +523,7 @@ mod tests {
527
523
#[ cfg( feature = "http1" ) ]
528
524
#[ test]
529
525
fn channel_buffers_one ( ) {
530
- let ( mut tx, _rx) = Incoming :: channel ( ) ;
526
+ let ( mut tx, _rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
531
527
532
528
tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
533
529
@@ -539,7 +535,7 @@ mod tests {
539
535
#[ cfg( not( miri) ) ]
540
536
#[ tokio:: test]
541
537
async fn channel_empty ( ) {
542
- let ( _, mut rx) = Incoming :: channel ( ) ;
538
+ let ( _, mut rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
543
539
544
540
assert ! ( rx. frame( ) . await . is_none( ) ) ;
545
541
}
0 commit comments