diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/Cargo.toml | 1 | ||||
-rw-r--r-- | client/src/lib.rs | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/client/Cargo.toml b/client/Cargo.toml index ea89057..05dd2d4 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -9,3 +9,4 @@ log = { workspace = true } reqwest = { version = "0.11.20", features = ["json"] } anyhow = "1.0.75" serde_json = "1.0.107" +tokio = { workspace = true } diff --git a/client/src/lib.rs b/client/src/lib.rs index 200c869..92545a9 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -12,6 +12,7 @@ use reqwest::{ use serde_json::json; use std::time::Duration; use stream::StreamSpec; +use tokio::io::AsyncWriteExt; pub use jellycommon::*; @@ -93,7 +94,7 @@ impl Session { &self, id: &str, role: &str, - mut writer: impl std::io::Write, + mut writer: impl tokio::io::AsyncWrite + std::marker::Unpin, ) -> Result<()> { debug!("downloading asset {role:?} for {id:?}"); let mut r = self @@ -102,7 +103,7 @@ impl Session { .send() .await?; while let Some(chunk) = r.chunk().await? { - writer.write_all(&chunk)?; + writer.write_all(&chunk).await?; } Ok(()) } |