fn bin_search(&self, cond: F) -> Option<usize> {
        let mut left = -1;
        let mut right = self.len() as isize;

        while right - left > 1 {
            let mid = (right + left) / 2;
            if cond(&self[mid as usize]) {
                right = mid;
            } else {
                left = mid;
            }
        }
        if right == self.len() as isize {
            None
        } else if left == -1 {
            Some(0)
        } else {
            Some(right as usize)
        }
    }
// Assume that the slice is monotone on givin contdition,
// that is, condition is like [fffffftttttttt]
Assume that the slice is monotone on givin contdition,
that is, condition is like [fffffftttttttt]
Assume that the slice is monotone on givin contdition that is condition is like [ fffffftttttttt ]
fn bin_search(&self, cond: F) -> Option<usize> {
        let mut left = -1;
        let mut right = self.len() as isize;
        while right - left > 1 {
            let mid = (right + left) / 2;
            if cond(&self[mid as usize]) {
                right = mid;
            } else {
                left = mid;
            }
        }
        if right == self.len() as isize {
            None
        } else if left == -1 {
            Some(0)
        } else {
            Some(right as usize)
        }
    }
fn bin_search ( & self , cond : F ) -> Option < usize > { let mut left = - 1 ; let mut right = self . len ( ) as isize ; while right - left > 1 { let mid = ( right + left ) / 2 ; if cond ( & self [ mid as usize ] ) { right = mid ; } else { left = mid ; } } if right == self . len ( ) as isize { None } else if left == - 1 { Some ( 0 ) } else { Some ( right as usize ) } }
Assume that the slice is monotone on givin contdition,
that is, condition is like [fffffftttttttt]
Assume that the slice is monotone on givin contdition that is condition is like [ fffffftttttttt ]
&self
cond
F
&self
cond
F