tokio looks like this on some random dude's webpage

This commit is contained in:
Quaternions 2024-01-11 21:29:06 -08:00
parent 9dc67a22c1
commit e8ef06c2cb

View File

@ -164,7 +164,7 @@ fn maybe_gzip_decode<R:Read>(input:R)->AResult<ReaderType<R>>{
async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFileMap)->AResult<()>{ async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFileMap)->AResult<()>{
let client=reqwest::Client::new(); let client=reqwest::Client::new();
futures::stream::iter(asset_id_file_map) futures::stream::iter(asset_id_file_map.into_iter()
.map(|(asset_id,file)|{ .map(|(asset_id,file)|{
let client=&client; let client=&client;
let cookie=cookie.as_str(); let cookie=cookie.as_str();
@ -202,7 +202,7 @@ async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFi
Ok((asset_id,resp.bytes().await?)) Ok((asset_id,resp.bytes().await?))
} }
}) }))
.buffer_unordered(CONCURRENT_REQUESTS) .buffer_unordered(CONCURRENT_REQUESTS)
.for_each(|b:AResult<_>|async{ .for_each(|b:AResult<_>|async{
match b{ match b{
@ -223,7 +223,7 @@ fn read_readable(mut readable:impl Read)->AResult<Vec<u8>>{
async fn download_list(cookie:String,asset_id_file_map:AssetIDFileMap)->AResult<()>{ async fn download_list(cookie:String,asset_id_file_map:AssetIDFileMap)->AResult<()>{
let client=reqwest::Client::new(); let client=reqwest::Client::new();
futures::stream::iter(asset_id_file_map) futures::stream::iter(asset_id_file_map.into_iter()
.map(|(asset_id,file)|{ .map(|(asset_id,file)|{
let client=&client; let client=&client;
let cookie=cookie.as_str(); let cookie=cookie.as_str();
@ -233,7 +233,7 @@ async fn download_list(cookie:String,asset_id_file_map:AssetIDFileMap)->AResult<
.send().await?; .send().await?;
Ok((file,resp.bytes().await?)) Ok((file,resp.bytes().await?))
} }
}) }))
.buffer_unordered(CONCURRENT_REQUESTS) .buffer_unordered(CONCURRENT_REQUESTS)
.for_each(|b:AResult<_>|async{ .for_each(|b:AResult<_>|async{
match b{ match b{
@ -814,7 +814,7 @@ async fn decompile_history_into_git(config:DecompileHistoryConfig)->AResult<()>{
let repo=git2::Repository::init(config.output_folder.clone())?; let repo=git2::Repository::init(config.output_folder.clone())?;
//decompile all versions //decompile all versions
futures::stream::iter(asset_list) futures::stream::iter(asset_list.into_iter()
.map(|asset_version|{ .map(|asset_version|{
let mut file_path=config.input_folder.clone(); let mut file_path=config.input_folder.clone();
tokio::task::spawn(async move{ tokio::task::spawn(async move{
@ -823,7 +823,7 @@ async fn decompile_history_into_git(config:DecompileHistoryConfig)->AResult<()>{
let contents=generate_decompiled_context(file)?; let contents=generate_decompiled_context(file)?;
Ok::<_,anyhow::Error>((asset_version,contents)) Ok::<_,anyhow::Error>((asset_version,contents))
}) })
}) }))
.buffered(CONCURRENT_DECODE) .buffered(CONCURRENT_DECODE)
.for_each(|join_handle_result|async{ .for_each(|join_handle_result|async{
match write_commit(WriteCommitConfig{ match write_commit(WriteCommitConfig{
@ -862,7 +862,7 @@ async fn download_and_decompile_history_into_git(config:DownloadAndDecompileHist
//download all versions //download all versions
let asset_id_string=config.asset_id.to_string(); let asset_id_string=config.asset_id.to_string();
futures::stream::iter(asset_list) futures::stream::iter(asset_list.into_iter()
.map(|asset_version|{ .map(|asset_version|{
let client=client.clone(); let client=client.clone();
let cookie=config.cookie.clone(); let cookie=config.cookie.clone();
@ -875,7 +875,7 @@ async fn download_and_decompile_history_into_git(config:DownloadAndDecompileHist
}; };
Ok::<_,anyhow::Error>((asset_version,contents)) Ok::<_,anyhow::Error>((asset_version,contents))
}) })
}) }))
.buffered(CONCURRENT_DECODE) .buffered(CONCURRENT_DECODE)
.for_each(|join_handle_result|async{ .for_each(|join_handle_result|async{
match write_commit(WriteCommitConfig{ match write_commit(WriteCommitConfig{