@@ -18,7 +18,7 @@ type TrailersSender = oneshot::Sender<HeaderMap>;
1818
1919/// A stream of `Bytes`, used when receiving bodies from the network.
2020#[ must_use = "streams do nothing unless polled" ]
21- pub struct Recv {
21+ pub struct Incoming {
2222 kind : Kind ,
2323}
2424
@@ -65,17 +65,17 @@ pub(crate) struct Sender {
6565const WANT_PENDING : usize = 1 ;
6666const WANT_READY : usize = 2 ;
6767
68- impl Recv {
68+ impl Incoming {
6969 /// Create a `Body` stream with an associated sender half.
7070 ///
7171 /// Useful when wanting to stream chunks from another thread.
7272 #[ inline]
7373 #[ allow( unused) ]
74- pub ( crate ) fn channel ( ) -> ( Sender , Recv ) {
74+ pub ( crate ) fn channel ( ) -> ( Sender , Incoming ) {
7575 Self :: new_channel ( DecodedLength :: CHUNKED , /*wanter =*/ false )
7676 }
7777
78- pub ( crate ) fn new_channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Recv ) {
78+ pub ( crate ) fn new_channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
7979 let ( data_tx, data_rx) = mpsc:: channel ( 0 ) ;
8080 let ( trailers_tx, trailers_rx) = oneshot:: channel ( ) ;
8181
@@ -90,7 +90,7 @@ impl Recv {
9090 data_tx,
9191 trailers_tx : Some ( trailers_tx) ,
9292 } ;
93- let rx = Recv :: new ( Kind :: Chan {
93+ let rx = Incoming :: new ( Kind :: Chan {
9494 content_length,
9595 want_tx,
9696 data_rx,
@@ -100,18 +100,18 @@ impl Recv {
100100 ( tx, rx)
101101 }
102102
103- fn new ( kind : Kind ) -> Recv {
104- Recv { kind }
103+ fn new ( kind : Kind ) -> Incoming {
104+ Incoming { kind }
105105 }
106106
107107 #[ allow( dead_code) ]
108- pub ( crate ) fn empty ( ) -> Recv {
109- Recv :: new ( Kind :: Empty )
108+ pub ( crate ) fn empty ( ) -> Incoming {
109+ Incoming :: new ( Kind :: Empty )
110110 }
111111
112112 #[ cfg( feature = "ffi" ) ]
113- pub ( crate ) fn ffi ( ) -> Recv {
114- Recv :: new ( Kind :: Ffi ( crate :: ffi:: UserBody :: new ( ) ) )
113+ pub ( crate ) fn ffi ( ) -> Incoming {
114+ Incoming :: new ( Kind :: Ffi ( crate :: ffi:: UserBody :: new ( ) ) )
115115 }
116116
117117 #[ cfg( all( feature = "http2" , any( feature = "client" , feature = "server" ) ) ) ]
@@ -125,7 +125,7 @@ impl Recv {
125125 if !content_length. is_exact ( ) && recv. is_end_stream ( ) {
126126 content_length = DecodedLength :: ZERO ;
127127 }
128- let body = Recv :: new ( Kind :: H2 {
128+ let body = Incoming :: new ( Kind :: H2 {
129129 data_done : false ,
130130 ping,
131131 content_length,
@@ -151,7 +151,7 @@ impl Recv {
151151 }
152152}
153153
154- impl Body for Recv {
154+ impl Body for Incoming {
155155 type Data = Bytes ;
156156 type Error = crate :: Error ;
157157
@@ -259,7 +259,7 @@ impl Body for Recv {
259259 }
260260}
261261
262- impl fmt:: Debug for Recv {
262+ impl fmt:: Debug for Incoming {
263263 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
264264 #[ derive( Debug ) ]
265265 struct Streaming ;
@@ -375,15 +375,15 @@ mod tests {
375375 use std:: mem;
376376 use std:: task:: Poll ;
377377
378- use super :: { Body , DecodedLength , Recv , Sender , SizeHint } ;
378+ use super :: { Body , DecodedLength , Incoming , Sender , SizeHint } ;
379379 use http_body_util:: BodyExt ;
380380
381381 #[ test]
382382 fn test_size_of ( ) {
383383 // These are mostly to help catch *accidentally* increasing
384384 // the size by too much.
385385
386- let body_size = mem:: size_of :: < Recv > ( ) ;
386+ let body_size = mem:: size_of :: < Incoming > ( ) ;
387387 let body_expected_size = mem:: size_of :: < u64 > ( ) * 5 ;
388388 assert ! (
389389 body_size <= body_expected_size,
@@ -392,7 +392,7 @@ mod tests {
392392 body_expected_size,
393393 ) ;
394394
395- //assert_eq!(body_size, mem::size_of::<Option<Recv >>(), "Option<Recv >");
395+ //assert_eq!(body_size, mem::size_of::<Option<Incoming >>(), "Option<Incoming >");
396396
397397 assert_eq ! (
398398 mem:: size_of:: <Sender >( ) ,
@@ -409,18 +409,18 @@ mod tests {
409409
410410 #[ test]
411411 fn size_hint ( ) {
412- fn eq ( body : Recv , b : SizeHint , note : & str ) {
412+ fn eq ( body : Incoming , b : SizeHint , note : & str ) {
413413 let a = body. size_hint ( ) ;
414414 assert_eq ! ( a. lower( ) , b. lower( ) , "lower for {:?}" , note) ;
415415 assert_eq ! ( a. upper( ) , b. upper( ) , "upper for {:?}" , note) ;
416416 }
417417
418- eq ( Recv :: empty ( ) , SizeHint :: with_exact ( 0 ) , "empty" ) ;
418+ eq ( Incoming :: empty ( ) , SizeHint :: with_exact ( 0 ) , "empty" ) ;
419419
420- eq ( Recv :: channel ( ) . 1 , SizeHint :: new ( ) , "channel" ) ;
420+ eq ( Incoming :: channel ( ) . 1 , SizeHint :: new ( ) , "channel" ) ;
421421
422422 eq (
423- Recv :: new_channel ( DecodedLength :: new ( 4 ) , /*wanter =*/ false ) . 1 ,
423+ Incoming :: new_channel ( DecodedLength :: new ( 4 ) , /*wanter =*/ false ) . 1 ,
424424 SizeHint :: with_exact ( 4 ) ,
425425 "channel with length" ,
426426 ) ;
@@ -429,7 +429,7 @@ mod tests {
429429 #[ cfg( not( miri) ) ]
430430 #[ tokio:: test]
431431 async fn channel_abort ( ) {
432- let ( tx, mut rx) = Recv :: channel ( ) ;
432+ let ( tx, mut rx) = Incoming :: channel ( ) ;
433433
434434 tx. abort ( ) ;
435435
@@ -440,7 +440,7 @@ mod tests {
440440 #[ cfg( all( not( miri) , feature = "http1" ) ) ]
441441 #[ tokio:: test]
442442 async fn channel_abort_when_buffer_is_full ( ) {
443- let ( mut tx, mut rx) = Recv :: channel ( ) ;
443+ let ( mut tx, mut rx) = Incoming :: channel ( ) ;
444444
445445 tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
446446 // buffer is full, but can still send abort
@@ -462,7 +462,7 @@ mod tests {
462462 #[ cfg( feature = "http1" ) ]
463463 #[ test]
464464 fn channel_buffers_one ( ) {
465- let ( mut tx, _rx) = Recv :: channel ( ) ;
465+ let ( mut tx, _rx) = Incoming :: channel ( ) ;
466466
467467 tx. try_send_data ( "chunk 1" . into ( ) ) . expect ( "send 1" ) ;
468468
@@ -474,14 +474,14 @@ mod tests {
474474 #[ cfg( not( miri) ) ]
475475 #[ tokio:: test]
476476 async fn channel_empty ( ) {
477- let ( _, mut rx) = Recv :: channel ( ) ;
477+ let ( _, mut rx) = Incoming :: channel ( ) ;
478478
479479 assert ! ( rx. frame( ) . await . is_none( ) ) ;
480480 }
481481
482482 #[ test]
483483 fn channel_ready ( ) {
484- let ( mut tx, _rx) = Recv :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ false ) ;
484+ let ( mut tx, _rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ false ) ;
485485
486486 let mut tx_ready = tokio_test:: task:: spawn ( tx. ready ( ) ) ;
487487
@@ -490,7 +490,8 @@ mod tests {
490490
491491 #[ test]
492492 fn channel_wanter ( ) {
493- let ( mut tx, mut rx) = Recv :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
493+ let ( mut tx, mut rx) =
494+ Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
494495
495496 let mut tx_ready = tokio_test:: task:: spawn ( tx. ready ( ) ) ;
496497 let mut rx_data = tokio_test:: task:: spawn ( rx. frame ( ) ) ;
@@ -511,7 +512,7 @@ mod tests {
511512
512513 #[ test]
513514 fn channel_notices_closure ( ) {
514- let ( mut tx, rx) = Recv :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
515+ let ( mut tx, rx) = Incoming :: new_channel ( DecodedLength :: CHUNKED , /*wanter = */ true ) ;
515516
516517 let mut tx_ready = tokio_test:: task:: spawn ( tx. ready ( ) ) ;
517518
0 commit comments