Trait enso_prelude::SmallVecOps[][src]

pub trait SmallVecOps {
    type Item;
    fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
    where
        F: FnMut(&Self::Item) -> Ordering
;
fn binary_search(&self, t: &Self::Item) -> Result<usize, usize>
    where
        Self::Item: Ord
; }
Expand description

Adds methods to the SmallVec type.

Associated Types

Required methods

fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
    F: FnMut(&Self::Item) -> Ordering
[src]

Binary searches this sorted slice with a comparator function.

The comparator function should implement an order consistent with the sort order of the underlying slice, returning an order code that indicates whether its argument is Less, Equal or Greater the desired target.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

Implementation Details

Please note that the following implementation is a copy-paste from [Vec::binary_search_by].

Binary searches this sorted slice for a given element.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

Implementation Details

Please note that the following implementation is a copy-paste from [Vec::binary_search].

Implementors

impl<T: Array> SmallVecOps for SmallVec<T>[src]

type Item = <T as Array>::Item

fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
    F: FnMut(&Self::Item) -> Ordering
[src]