return download state clone

This commit is contained in:
2025-01-05 16:40:51 +08:00
parent 568b2fbd70
commit 07ee03b321

View File

@@ -22,7 +22,7 @@ struct DownloadState {
result: Mutex<Option<Result<DownloadData, (StatusCode, String)>>>, result: Mutex<Option<Result<DownloadData, (StatusCode, String)>>>,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
struct DownloadData { struct DownloadData {
body: Bytes, body: Bytes,
headers: reqwest::header::HeaderMap, headers: reqwest::header::HeaderMap,
@@ -45,10 +45,7 @@ impl Downloader {
let result = state.result.lock().await; let result = state.result.lock().await;
match &*result { match &*result {
Some(Ok(result)) => { Some(Ok(result)) => {
return Ok(DownloadData { return Ok(result.clone());
body: result.body.clone(),
headers: result.headers.clone(),
})
} }
Some(Err(e)) => return Err(e.clone()), Some(Err(e)) => return Err(e.clone()),
None => {} None => {}