Skip to content

Commit 6d17729

Browse files
committed
v0.2.1
1 parent e6d5c5b commit 6d17729

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ruget"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["ksk001100 <hm.pudding0715@gmail.com>"]
55
edition = "2018"
66
repository = "https://github.com/ksk001100/ruget"

src/lib/downloader/parallel.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ impl ParallelDownloader {
3030

3131
pub fn create_args(&self) -> Vec<(usize, String)> {
3232
let content_length = self.get_content_length();
33-
let split_num = content_length / TMP_SIZE as i32;
34-
let ranges: Vec<i32> = (0..split_num)
33+
let split_num = content_length / TMP_SIZE;
34+
let ranges: Vec<usize> = (0..split_num)
3535
.map(|n| (content_length + n) / split_num)
3636
.collect();
3737

@@ -79,15 +79,15 @@ impl ParallelDownloader {
7979
remove_dir_all(TMP_DIR).expect("remove tmp file failed...");
8080
}
8181

82-
pub fn get_content_length(&self) -> i32 {
82+
pub fn get_content_length(&self) -> usize {
8383
let resp = self.client.head(&self.url).send().expect("head failed...");
8484

8585
let length = resp
8686
.headers()
8787
.get(CONTENT_LENGTH)
8888
.expect("cannot get content-length...");
8989

90-
(length.to_str().unwrap()).parse::<i32>().unwrap()
90+
(length.to_str().unwrap()).parse::<usize>().unwrap()
9191
}
9292
}
9393

0 commit comments

Comments
 (0)