@@ -101,7 +101,7 @@ const WANT_READY: usize = 2;
101
101
102
102
impl Incoming {
103
103
#[ cfg( all( feature = "http1" , any( feature = "client" , feature = "server" ) ) ) ]
104
- pub ( crate ) fn new_channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
104
+ pub ( crate ) fn channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
105
105
let ( data_tx, data_rx) = mpsc:: channel ( 0 ) ;
106
106
let ( trailers_tx, trailers_rx) = oneshot:: channel ( ) ;
107
107
@@ -474,13 +474,13 @@ mod tests {
474
474
eq ( Incoming :: empty ( ) , SizeHint :: with_exact ( 0 ) , "empty" ) ;
475
475
476
476
eq (
477
- Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) . 1 ,
477
+ Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) . 1 ,
478
478
SizeHint :: new ( ) ,
479
479
"channel" ,
480
480
) ;
481
481
482
482
eq (
483
- Incoming :: new_channel ( DecodedLength :: new ( 4 ) , /*wanter =*/ false ) . 1 ,
483
+ Incoming :: channel ( DecodedLength :: new ( 4 ) , /*wanter =*/ false ) . 1 ,
484
484
SizeHint :: with_exact ( 4 ) ,
485
485
"channel with length" ,
486
486
) ;
@@ -489,7 +489,7 @@ mod tests {
489
489
#[ cfg( not( miri) ) ]
490
490
#[ tokio:: test]
491
491
async fn channel_abort ( ) {
492
- let ( tx, mut rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
492
+ let ( tx, mut rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
493
493
494
494
tx. abort ( ) ;
495
495
@@ -500,8 +500,7 @@ mod tests {
500
500
#[ cfg( all( not( miri) , feature = "http1" ) ) ]
501
501
#[ tokio:: test]
502
502
async fn channel_abort_when_buffer_is_full ( ) {
503
- let ( mut tx, mut rx) =
504
- Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
503
+ let ( mut tx, mut rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
505
504
506
505
tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
507
506
// buffer is full, but can still send abort
@@ -523,7 +522,7 @@ mod tests {
523
522
#[ cfg( feature = "http1" ) ]
524
523
#[ test]
525
524
fn channel_buffers_one ( ) {
526
- let ( mut tx, _rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
525
+ let ( mut tx, _rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
527
526
528
527
tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
529
528
@@ -535,14 +534,14 @@ mod tests {
535
534
#[ cfg( not( miri) ) ]
536
535
#[ tokio:: test]
537
536
async fn channel_empty ( ) {
538
- let ( _, mut rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
537
+ let ( _, mut rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter =*/ false ) ;
539
538
540
539
assert ! ( rx. frame( ) . await . is_none( ) ) ;
541
540
}
542
541
543
542
#[ test]
544
543
fn channel_ready ( ) {
545
- let ( mut tx, _rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ false ) ;
544
+ let ( mut tx, _rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter = */ false ) ;
546
545
547
546
let mut tx_ready = tokio_test:: task:: spawn ( tx. ready ( ) ) ;
548
547
@@ -551,8 +550,7 @@ mod tests {
551
550
552
551
#[ test]
553
552
fn channel_wanter ( ) {
554
- let ( mut tx, mut rx) =
555
- Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
553
+ let ( mut tx, mut rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
556
554
557
555
let mut tx_ready = tokio_test:: task:: spawn ( tx. ready ( ) ) ;
558
556
let mut rx_data = tokio_test:: task:: spawn ( rx. frame ( ) ) ;
@@ -573,7 +571,7 @@ mod tests {
573
571
574
572
#[ test]
575
573
fn channel_notices_closure ( ) {
576
- let ( mut tx, rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
574
+ let ( mut tx, rx) = Incoming :: channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
577
575
578
576
let mut tx_ready = tokio_test:: task:: spawn ( tx. ready ( ) ) ;
579
577
0 commit comments