@@ -57,12 +57,6 @@ enum Kind {
57
57
}
58
58
59
59
impl Incoming {
60
- #[ cfg( all( feature = "http1" , any( feature = "client" , feature = "server" ) ) ) ]
61
- pub ( crate ) fn channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
62
- let ( tx, chan) = ChanBody :: new ( content_length, wanter) ;
63
- ( tx, Incoming :: new ( Kind :: Chan ( chan) ) )
64
- }
65
-
66
60
fn new ( kind : Kind ) -> Incoming {
67
61
Incoming { kind }
68
62
}
@@ -71,22 +65,32 @@ impl Incoming {
71
65
pub ( crate ) fn empty ( ) -> Incoming {
72
66
Incoming :: new ( Kind :: Empty )
73
67
}
68
+ }
74
69
75
- #[ cfg( feature = "ffi" ) ]
76
- pub ( crate ) fn ffi ( ) -> Incoming {
77
- Incoming :: new ( Kind :: Ffi ( crate :: ffi:: UserBody :: new ( ) ) )
70
+ #[ cfg( any( feature = "client" , feature = "server" ) ) ]
71
+ impl Incoming {
72
+ #[ cfg( feature = "http1" ) ]
73
+ pub ( crate ) fn channel ( content_length : DecodedLength , wanter : bool ) -> ( Sender , Incoming ) {
74
+ let ( tx, chan) = ChanBody :: new ( content_length, wanter) ;
75
+ ( tx, Incoming :: new ( Kind :: Chan ( chan) ) )
78
76
}
79
77
80
- #[ cfg( all ( feature = "http2" , any ( feature = "client" , feature = "server" ) ) ) ]
78
+ #[ cfg( feature = "http2" ) ]
81
79
pub ( crate ) fn h2 (
82
80
recv : :: h2:: RecvStream ,
83
81
content_length : DecodedLength ,
84
82
ping : ping:: Recorder ,
85
83
) -> Self {
86
84
Incoming :: new ( Kind :: H2 ( H2Body :: new ( recv, content_length, ping) ) )
87
85
}
86
+ }
87
+
88
+ #[ cfg( feature = "ffi" ) ]
89
+ impl Incoming {
90
+ pub ( crate ) fn ffi ( ) -> Incoming {
91
+ Incoming :: new ( Kind :: Ffi ( crate :: ffi:: UserBody :: new ( ) ) )
92
+ }
88
93
89
- #[ cfg( feature = "ffi" ) ]
90
94
pub ( crate ) fn as_ffi_mut ( & mut self ) -> & mut crate :: ffi:: UserBody {
91
95
match self . kind {
92
96
Kind :: Ffi ( ref mut body) => return body,
0 commit comments