Crates.io | bound-stl |
lib.rs | bound-stl |
version | 0.1.2 |
source | src |
created_at | 2023-02-25 05:39:45.1476 |
updated_at | 2023-02-28 05:06:26.139649 |
description | Bound-STL attempts to implement lower_bound and upper_bound in C++ STL. |
homepage | |
repository | https://github.com/ssrlive/bound-stl |
max_upload_size | |
id | 794185 |
size | 49,823 |
Bound-STL attempts to implement Rust copy of lower_bound
and upper_bound
manners in C++ STL.
This implementation is adding two traits LowerBound
and UpperBound
to the follow structures:
[..]
Vec
VecDeque
BinaryHeap
BTreeset
BTreeMap
This repo hosts at bound-stl
use bound_stl::LowerBound;
let v = vec![1, 2, 3, 4, 5];
assert_eq!(v.lower_bound(&3), Ok(2));
assert_eq!(v.lower_bound(&6), Err(5));
use bound_stl::UpperBound;
let v = vec![1, 2, 3, 4, 5];
assert_eq!(v.upper_bound(&3), Ok(3));
assert_eq!(v.upper_bound(&6), Err(5));