pub trait Bound<T> {
    fn lower_bound(&self, x: &T) -> usize;
    fn upper_bound(&self, x: &T) -> usize;
}

Required Methods

Implementations on Foreign Types

Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.

use k0i::bounds::Bound;
let vec = vec![1, 2, 4, 6];
assert_eq!(vec.lower_bound(&4), 2);

If the candidate is larger than set’s larget item,returns set’s last index.

use k0i::bounds::Bound;
let vec = vec![1, 2, 4, 6];
assert_eq!(vec.lower_bound(&1000), 3);

Returns an iterator pointing to the first element in the range [first,last) which compares greater than val.

use k0i::bounds::Bound;
let vec = vec![1, 2, 4, 6];
assert_eq!(vec.upper_bound(&4), 3);

If the candidate is larger than set’s larget item,returns set’s last index.

use k0i::bounds::Bound;
let vec = vec![2, 2, 4, 6];
assert_eq!(vec.upper_bound(&1000), 3);

Implementors