(s: &mut dyn OutputStream, mut bytes: Bytes)
| 355 | } |
| 356 | |
| 357 | async fn blocking_write_and_flush(s: &mut dyn OutputStream, mut bytes: Bytes) -> Result<()> { |
| 358 | while !bytes.is_empty() { |
| 359 | let permit = s.write_ready().await?; |
| 360 | let len = bytes.len().min(permit); |
| 361 | let chunk = bytes.split_to(len); |
| 362 | s.write(chunk)?; |
| 363 | } |
| 364 | |
| 365 | s.flush()?; |
| 366 | s.write_ready().await?; |
| 367 | Ok(()) |
| 368 | } |
| 369 | } |
no test coverage detected