BinarySearchExtension
struct · ferroui-base · v0.5.0
struct BinarySearchExtension
Binary searching of a list with a comparer.
Unlike slice::binary_search_by, which may return any of several equal
items, the search visits the items in a fixed order. The result is the
index of the found item or the bitwise complement of the index of the
next larger item.
Members
binary_search
fn binary_search<T>(list: &[T], value: &T, comparer: impl Fn(&T, &T) -> Ordering) -> i32
Performs a binary search on the entire contents of a list.
Returns the index of the found item; otherwise the bitwise complement of the index of the next larger item.
binary_search_range
fn binary_search_range<T>(list: &[T], index: i32, length: i32, value: &T, comparer: impl Fn(&T, &T) -> Ordering) -> i32
Performs a binary search on a subset of a list: length items
starting at index.
Returns the index of the found item; otherwise the bitwise complement of the index of the next larger item.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.