return download state clone
This commit is contained in:
@@ -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 => {}
|
||||||
|
|||||||
Reference in New Issue
Block a user