Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ exclude = ["test-data/*"]
futures = "0.3.28"
http-content-range = "0.1.2"
itertools = "0.12.1"
bisection = "0.1.0"
memmap2 = "0.9.0"
reqwest = { version = "0.12.3", default-features = false, features = ["stream"] }
reqwest-middleware = "0.3.0"
Expand Down
9 changes: 4 additions & 5 deletions src/sparse_range.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use bisection::{bisect_left, bisect_right};
use itertools::Itertools;
use std::{
fmt::{Debug, Display, Formatter},
Expand Down Expand Up @@ -55,8 +54,8 @@ impl SparseRange {
let range_end = range.end - 1;

// Compute the indices of the ranges that are covered by the request
let left_index = bisect_left(&self.right, &range_start);
let right_index = bisect_right(&self.left, &(range_end + 1));
let left_index = self.right.partition_point(|x| x < &range_start);
let right_index = self.left.partition_point(|x| x <= &(range_end + 1));

// Get all the range bounds that are covered
let left_slice = &self.left[left_index..right_index];
Expand Down Expand Up @@ -97,8 +96,8 @@ impl SparseRange {
let range_end = range.end - 1;

// Compute the indices of the ranges that are covered by the request
let left_index = bisect_left(&self.right, &range_start);
let right_index = bisect_right(&self.left, &(range_end + 1));
let left_index = self.right.partition_point(|x| x < &range_start);
let right_index = self.left.partition_point(|x| x <= &(range_end + 1));

// Get all the range bounds that are covered
let left_slice = &self.left[left_index..right_index];
Expand Down