Function peroxide::util::useful::find_interval

source ·
pub fn find_interval<T: PartialOrd + PartialEq>(
    sorted_intervals: &Vec<(T, T)>,
    x: T,
) -> usize
Expand description

Find the index of interval of x

§Examples

extern crate peroxide;
use peroxide::fuga::*;

let x = vec![
    (0, 5),
    (5, 7),
    (7, 10),
    (10, 15),
    (15, 20),
    (20, 30)
];

assert_eq!(find_interval(&x, 11), 3);