File tree 5 files changed +11
-11
lines changed
5 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ futures-core = { version = "0.3", default-features = false }
24
24
futures-channel = " 0.3"
25
25
futures-util = { version = " 0.3" , default-features = false }
26
26
http = " 0.2"
27
- http-body = " 1.0.0-rc.1 "
28
- http-body-util = { version = " 0.1.0-rc.1 " , optional = true }
27
+ http-body = " = 1.0.0-rc.2 "
28
+ http-body-util = { version = " = 0.1.0-rc.2 " , optional = true }
29
29
httpdate = " 1.0"
30
30
httparse = " 1.8"
31
31
h2 = { version = " 0.3.9" , optional = true }
@@ -42,7 +42,7 @@ socket2 = { version = "0.4", optional = true }
42
42
43
43
[dev-dependencies ]
44
44
futures-util = { version = " 0.3" , default-features = false , features = [" alloc" ] }
45
- http-body-util = " 0.1.0-rc.1 "
45
+ http-body-util = " = 0.1.0-rc.2 "
46
46
matches = " 0.1"
47
47
num_cpus = " 1.0"
48
48
pretty_env_logger = " 0.4"
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ async fn echo(
27
27
// Convert to uppercase before sending back to client using a stream.
28
28
( & Method :: POST , "/echo/uppercase" ) => {
29
29
let frame_stream = req. into_body ( ) . map_frame ( |frame| {
30
- let frame = if let Some ( data) = frame. into_data ( ) {
30
+ let frame = if let Ok ( data) = frame. into_data ( ) {
31
31
data. iter ( )
32
32
. map ( |byte| byte. to_ascii_uppercase ( ) )
33
33
. collect :: < Bytes > ( )
Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ ffi_fn! {
63
63
loop {
64
64
match body. 0 . frame( ) . await {
65
65
Some ( Ok ( frame) ) => {
66
- if frame. is_data ( ) {
67
- return Ok ( Some ( hyper_buf( frame . into_data ( ) . unwrap ( ) ) ) ) ;
66
+ if let Ok ( data ) = frame. into_data ( ) {
67
+ return Ok ( Some ( hyper_buf( data ) ) ) ;
68
68
} else {
69
69
continue ;
70
70
}
@@ -95,7 +95,7 @@ ffi_fn! {
95
95
Box :: into_raw( hyper_task:: boxed( async move {
96
96
while let Some ( item) = body. 0 . frame( ) . await {
97
97
let frame = item?;
98
- if let Some ( chunk) = frame. into_data( ) {
98
+ if let Ok ( chunk) = frame. into_data( ) {
99
99
if HYPER_ITER_CONTINUE != func( userdata. 0 , & hyper_buf( chunk) ) {
100
100
return Err ( crate :: Error :: new_user_aborted_by_callback( ) ) ;
101
101
}
Original file line number Diff line number Diff line change @@ -339,8 +339,8 @@ where
339
339
* clear_body = true ;
340
340
crate :: Error :: new_user_body ( e)
341
341
} ) ?;
342
- let chunk = if frame. is_data ( ) {
343
- frame . into_data ( ) . unwrap ( )
342
+ let chunk = if let Ok ( data ) = frame. into_data ( ) {
343
+ data
344
344
} else {
345
345
trace ! ( "discarding non-data frame" ) ;
346
346
continue ;
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ where
156
156
match ready ! ( me. stream. as_mut( ) . poll_frame( cx) ) {
157
157
Some ( Ok ( frame) ) => {
158
158
if frame. is_data ( ) {
159
- let chunk = frame. into_data ( ) . unwrap ( ) ;
159
+ let chunk = frame. into_data ( ) . unwrap_or_else ( |_| unreachable ! ( ) ) ;
160
160
let is_eos = me. stream . is_end_stream ( ) ;
161
161
trace ! (
162
162
"send body chunk: {} bytes, eos={}" ,
@@ -176,7 +176,7 @@ where
176
176
// no more DATA, so give any capacity back
177
177
me. body_tx . reserve_capacity ( 0 ) ;
178
178
me. body_tx
179
- . send_trailers ( frame. into_trailers ( ) . unwrap ( ) )
179
+ . send_trailers ( frame. into_trailers ( ) . unwrap_or_else ( |_| unreachable ! ( ) ) )
180
180
. map_err ( crate :: Error :: new_body_write) ?;
181
181
return Poll :: Ready ( Ok ( ( ) ) ) ;
182
182
} else {
You can’t perform that action at this time.
0 commit comments