async download

This commit is contained in:
Quaternions 2024-01-01 12:21:33 -08:00
parent edf24cac96
commit 929484855d

View File

@ -4,6 +4,7 @@ use anyhow::Result as AResult;
use futures::StreamExt; use futures::StreamExt;
type AssetID=u64; type AssetID=u64;
const CONCURRENT_REQUESTS:usize=8;
#[derive(Parser)] #[derive(Parser)]
#[command(author,version,about,long_about=None)] #[command(author,version,about,long_about=None)]
@ -59,8 +60,6 @@ fn upload_file(_path:std::path::PathBuf,_asset_id:AssetID)->AResult<()>{
Ok(()) Ok(())
} }
const CONCURRENT_REQUESTS:usize=8;
fn read_readable(mut readable:impl Read)->AResult<Vec<u8>>{ fn read_readable(mut readable:impl Read)->AResult<Vec<u8>>{
let mut contents=Vec::new(); let mut contents=Vec::new();
readable.read_to_end(&mut contents)?; readable.read_to_end(&mut contents)?;
@ -103,4 +102,4 @@ async fn download_list(asset_ids:Vec<AssetID>)->AResult<()>{
} }
}).await; }).await;
Ok(()) Ok(())
} }