pub fn to_offset(&self, position: Position) -> usize {
        let position = WrappedPosition::from(position);
        if !self.cache_position2offset.read().contains_key(&position) {
            let (line_start_offset, _) = self.lines[position.line];
            let offset = line_start_offset + position.co;
            self.cache_position2offset.write().insert(position, offset);
        }

        *self.cache_position2offset.read().get(&position).unwrap()
    }
/// Returns the byte offset corresponding to a line/column position in the source.
Returns the byte offset corresponding to a line/column position in the source.
Returns the byte offset corresponding to a line / column position in the source .
pub fn to_offset(&self, position: Position) -> usize {
        let position = WrappedPosition::from(position);
        if !self.cache_position2offset.read().contains_key(&position) {
            let (line_start_offset, _) = self.lines[position.line];
            let offset = line_start_offset + position.co;
            self.cache_position2offset.write().insert(position, offset);
        }
        *self.cache_position2offset.read().get(&position).unwrap()
    }
pub fn to_offset ( & self , position : Position ) -> usize { let position = WrappedPosition :: from ( position ) ; if ! self . cache_position2offset . read ( ) . contains_key ( & position ) { let ( line_start_offset , _ ) = self . lines [ position . line ] ; let offset = line_start_offset + position . co ; self . cache_position2offset . write ( ) . insert ( position , offset ) ; } * self . cache_position2offset . read ( ) . get ( & position ) . unwrap ( ) }
Returns the byte offset corresponding to a line/column position in the source.
Returns the byte offset corresponding to a line / column position in the source .
&self
position
Position
&self
position
Position