Skip to content

Commit 00e889d

Browse files
committed
fix: 修复 DownloadResult 的 Clone 功能错误的问题
1 parent 91c546a commit 00e889d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

crates/fast-down/src/url_info.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use url::Url;
44
#[derive(Debug, Clone, PartialEq, Eq)]
55
pub struct UrlInfo {
66
pub size: u64,
7+
/// 服务器返回的原始文件名,必须清洗掉不合法字符才能安全使用
78
pub name: String,
89
pub supports_range: bool,
910
pub fast_download: bool,

crates/fast-pull/src/core/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,25 @@ pub mod mock;
1414
pub mod multi;
1515
pub mod single;
1616

17-
#[derive(Debug, Clone)]
17+
#[derive(Debug)]
1818
pub struct DownloadResult<E: Executor, PullError, PushError> {
1919
pub event_chain: AsyncReceiver<Event<PullError, PushError>>,
2020
handle: Arc<Mutex<Option<JoinHandle<()>>>>,
2121
abort_handles: Option<Arc<[AbortHandle]>>,
2222
task_list: Option<Weak<TaskList<E>>>,
2323
}
2424

25+
impl<E: Executor, PullError, PushError> Clone for DownloadResult<E, PullError, PushError> {
26+
fn clone(&self) -> Self {
27+
Self {
28+
event_chain: self.event_chain.clone(),
29+
handle: self.handle.clone(),
30+
abort_handles: self.abort_handles.clone(),
31+
task_list: self.task_list.clone(),
32+
}
33+
}
34+
}
35+
2536
impl<E: Executor, PullError, PushError> DownloadResult<E, PullError, PushError> {
2637
pub fn new(
2738
event_chain: AsyncReceiver<Event<PullError, PushError>>,

0 commit comments

Comments
 (0)