FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    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.

    Source

    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.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.