fn lookup_line(&self, pos: BytePos) -> Result<FileMapAndLine, Rc<FileMap>> {
        let idx = self.lookup_filemap_idx(pos);

        let files = self.files.borrow();
        let f = (*files)[idx].clone();

        let len = f.lines.borrow().len();
        if len == 0 {
            return Err(f);
        }

        let mut a = 0;
        {
            let lines = f.lines.borrow();
            let mut b = lines.len();
            while b - a > 1 {
                let m = (a + b) / 2;
                if (*lines)[m] > pos {
                    b = m;
                } else {
                    a = m;
                }
            }
            assert!(a <= lines.len());
        }
        Ok(FileMapAndLine { fm: f, line: a })
    }
// If the relevant filemap is empty, we don't return a line number.
If the relevant filemap is empty, we don't return a line number.
If the relevant filemap is empty we don ' t return a line number .
fn lookup_line(&self, pos: BytePos) -> Result<FileMapAndLine, Rc<FileMap>> {
        let idx = self.lookup_filemap_idx(pos);
        let files = self.files.borrow();
        let f = (*files)[idx].clone();
        let len = f.lines.borrow().len();
        if len == 0 {
            return Err(f);
        }
        let mut a = 0;
        {
            let lines = f.lines.borrow();
            let mut b = lines.len();
            while b - a > 1 {
                let m = (a + b) / 2;
                if (*lines)[m] > pos {
                    b = m;
                } else {
                    a = m;
                }
            }
            assert!(a <= lines.len());
        }
        Ok(FileMapAndLine { fm: f, line: a })
    }
fn lookup_line ( & self , pos : BytePos ) -> Result < FileMapAndLine , Rc < FileMap > > { let idx = self . lookup_filemap_idx ( pos ) ; let files = self . files . borrow ( ) ; let f = ( * files ) [ idx ] . clone ( ) ; let len = f . lines . borrow ( ) . len ( ) ; if len == 0 { return Err ( f ) ; } let mut a = 0 ; { let lines = f . lines . borrow ( ) ; let mut b = lines . len ( ) ; while b - a > 1 { let m = ( a + b ) / 2 ; if ( * lines ) [ m ] > pos { b = m ; } else { a = m ; } } assert ! ( a lines len ( ) ) ; } Ok ( FileMapAndLine { fm : f , line : a } ) }
If the relevant filemap is empty, we don't return a line number.
If the relevant filemap is empty we don ' t return a line number .
&self
pos
BytePos
&self
pos
BytePos