fn index<'b>(&'b self, idx: usize) -> &'b T {
        let (piece_idx, norm_idx) = match self.idx_to_location(idx) {
            PieceHead(piece_idx) => (piece_idx, 0),
            PieceMid(piece_idx, norm_idx) |
            PieceTail(piece_idx, norm_idx) => (piece_idx, norm_idx),
            EOF => panic!("PieceTable out of bounds: {}", idx),
        };

        let ref piece = self.pieces[piece_idx];
        match piece.buffer {
            Add => &self.adds[piece.start + norm_idx],
            Original => &self.original[piece.start + norm_idx],
        }
    }
/// Note: Reading an index takes `O(p)` time, use iterators for fast sequential access.
Reading an index takes `O(p)` time, use iterators for fast sequential access.
Reading an index takes ` O ( p ) ` time use iterators for fast sequential access .
fn index<'b>(&'b self, idx: usize) -> &'b T {
        let (piece_idx, norm_idx) = match self.idx_to_location(idx) {
            PieceHead(piece_idx) => (piece_idx, 0),
            PieceMid(piece_idx, norm_idx) |
            PieceTail(piece_idx, norm_idx) => (piece_idx, norm_idx),
            EOF => panic!("PieceTable out of bounds: {}", idx),
        };
        let ref piece = self.pieces[piece_idx];
        match piece.buffer {
            Add => &self.adds[piece.start + norm_idx],
            Original => &self.original[piece.start + norm_idx],
        }
    }
fn index < ' b > ( & ' b self , idx : usize ) -> & ' b T { let ( piece_idx , norm_idx ) = match self . idx_to_location ( idx ) { PieceHead ( piece_idx ) => ( piece_idx , 0 ) , PieceMid ( piece_idx , norm_idx ) | PieceTail ( piece_idx , norm_idx ) => ( piece_idx , norm_idx ) , EOF => panic ! ( " " idx ) , } ; let ref piece = self . pieces [ piece_idx ] ; match piece . buffer { Add => & self . adds [ piece . start + norm_idx ] , Original => & self . original [ piece . start + norm_idx ] , } }
Note: Reading an index takes `O(p)` time, use iterators for fast sequential access.
Note : Reading an index takes ` O ( p ) ` time use iterators for fast sequential access .
&'b self
idx
usize
&'b self
idx
usize