Skip to content

Commit

Permalink
chore(lib.rs): add assertion to validate bin values in bin2bounds met…
Browse files Browse the repository at this point in the history
…hod for safety and correctness
  • Loading branch information
PMassicotte committed Sep 11, 2023
1 parent b62d7ff commit 3ee5144
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ impl Isin {
/// # Note
/// The bounds are returned in the order north, south, west, east.
pub fn bin2bounds(&self, bin: &mut Vec<usize>) -> Vec<(f64, f64, f64, f64)> {
assert_eq!(bin.iter().all(|&b| b >= 1 && b <= self.totbin), true);

let mut result: Vec<(f64, f64, f64, f64)> = Vec::with_capacity(bin.len());

for bin_val in bin.iter_mut() {
Expand Down

0 comments on commit 3ee5144

Please sign in to comment.