异步流 `hyper::body::Body` 到 Rust 中的文件

Dan*_*son 5 rust async-await hyper

如何使用或特征从 a 流式传输hyper::body::Body到文件。似乎在 0.13.5 中无法创建,因此在如下代码片段中不可能从转换为:tokio::io::AsyncWriteExttokio::io::{AsyncRead,AsyncWrite}hyper::error::Errorstd::io::Errorhyper::error::Error

req.into_body().try_fold(file, |file, chunk| async move {
    file.write_all(chunk.as_ref()).await.map(|_| file)
});
Run Code Online (Sandbox Code Playgroud)

有没有一种简单的方法可以做到这一点?