pub fn binary_search(&self, elem: usize) -> Result<usize, usize> {
        let mut low = 0;
        let mut high = self.len();
        let mut error = 0;
        while low < high {
            let mid = low + (high - low) / 2;
            match self.index(mid).cmp(&elem) {
                Ordering::Equal => return Ok(mid),
                Ordering::Greater => {
                    high = mid;
                    error = high
                },
                Ordering::Less => {
                    low = mid + 1;
                    error = low;
                },
            }
        }
        Err(error)
    }
/// Performs a binary search on this index array. `Ok` means it was found,
/// `Err` means it was not found, but we have the position where it would
/// be.
Performs a binary search on this index array. `Ok` means it was found,
`Err` means it was not found, but we have the position where it would
be.
Performs a binary search on this index array . ` Ok ` means it was found ` Err ` means it was not found but we have the position where it would be .
pub fn binary_search(&self, elem: usize) -> Result<usize, usize> {
        let mut low = 0;
        let mut high = self.len();
        let mut error = 0;
        while low < high {
            let mid = low + (high - low) / 2;
            match self.index(mid).cmp(&elem) {
                Ordering::Equal => return Ok(mid),
                Ordering::Greater => {
                    high = mid;
                    error = high
                },
                Ordering::Less => {
                    low = mid + 1;
                    error = low;
                },
            }
        }
        Err(error)
    }
pub fn binary_search ( & self , elem : usize ) -> Result < usize , usize > { let mut low = 0 ; let mut high = self . len ( ) ; let mut error = 0 ; while low < high { let mid = low + ( high - low ) / 2 ; match self . index ( mid ) . cmp ( & elem ) { Ordering :: Equal => return Ok ( mid ) , Ordering :: Greater => { high = mid ; error = high } , Ordering :: Less => { low = mid + 1 ; error = low ; } , } } Err ( error ) }
Performs a binary search on this index array.
Performs a binary search on this index array .
&self
elem
usize
&self
elem
usize