@@ -115,32 +115,6 @@ pub mod hyper {
115
115
use std:: time:: Duration ;
116
116
use tokio:: time;
117
117
118
- pub struct Body ( Full < Bytes > ) ;
119
-
120
- impl HttpBody for Body {
121
- type Data = Bytes ;
122
- type Error = Infallible ;
123
-
124
- #[ inline]
125
- fn poll_frame (
126
- self : Pin < & mut Self > ,
127
- cx : & mut task:: Context < ' _ > ,
128
- ) -> Poll < Option < Result < Frame < Self :: Data > , Self :: Error > > > {
129
- let inner_body = unsafe { self . map_unchecked_mut ( |b| & mut b. 0 ) } ;
130
- inner_body. poll_frame ( cx)
131
- }
132
-
133
- #[ inline]
134
- fn is_end_stream ( & self ) -> bool {
135
- self . 0 . is_end_stream ( )
136
- }
137
-
138
- #[ inline]
139
- fn size_hint ( & self ) -> hyper:: body:: SizeHint {
140
- self . 0 . size_hint ( )
141
- }
142
- }
143
-
144
118
#[ derive( Debug , Clone ) ]
145
119
pub struct HyperClient < C > {
146
120
inner : Client < C , Body > ,
@@ -194,6 +168,32 @@ pub mod hyper {
194
168
Ok ( http_response. error_for_status ( ) ?)
195
169
}
196
170
}
171
+
172
+ pub struct Body ( Full < Bytes > ) ;
173
+
174
+ impl HttpBody for Body {
175
+ type Data = Bytes ;
176
+ type Error = Box < dyn std:: error:: Error + Send + Sync + ' static > ;
177
+
178
+ #[ inline]
179
+ fn poll_frame (
180
+ self : Pin < & mut Self > ,
181
+ cx : & mut task:: Context < ' _ > ,
182
+ ) -> Poll < Option < Result < Frame < Self :: Data > , Self :: Error > > > {
183
+ let inner_body = unsafe { self . map_unchecked_mut ( |b| & mut b. 0 ) } ;
184
+ inner_body. poll_frame ( cx)
185
+ }
186
+
187
+ #[ inline]
188
+ fn is_end_stream ( & self ) -> bool {
189
+ self . 0 . is_end_stream ( )
190
+ }
191
+
192
+ #[ inline]
193
+ fn size_hint ( & self ) -> hyper:: body:: SizeHint {
194
+ self . 0 . size_hint ( )
195
+ }
196
+ }
197
197
}
198
198
199
199
/// Methods to make working with responses from the [`HttpClient`] trait easier.
0 commit comments