Skip to content

Commit 9251524

Browse files
downloader: Add some convinience methods related to download status
1 parent 2aac716 commit 9251524

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/downloader/handle.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ impl DownloadHandle {
3030
*self.status.borrow()
3131
}
3232

33+
pub fn is_completed(&self) -> bool {
34+
matches!(self.status(), Status::Completed)
35+
}
36+
37+
pub fn is_cancelled(&self) -> bool {
38+
matches!(self.status(), Status::Cancelled)
39+
}
40+
3341
pub async fn wait_for_status_update(&mut self) -> Result<(), watch::error::RecvError> {
3442
self.status.changed().await
3543
}

0 commit comments

Comments
 (0)