pub fn byte_offset_of_location(&self, location:Location)
    -> Result<Bytes,LocationError<Bytes>> {
        let mut column = 0.column();
        let mut offset = self.byte_offset_of_line_index(location.line)?;
        let max_offset = self.end_byte_offset_of_line_index(location.line)?;
        while column < location.column {
            match self.next_grapheme_offset(offset) {
                None      => return Err(LocationError::LineTooShort(offset)),
                Some(off) => {
                    offset  = off;
                    column += 1.column();
                }
            }
        }
        if offset > max_offset {
            Err(LocationError::LineTooShort(max_offset))
        } else {
            Ok(offset)
        }
    }
/// Byte offset of the given location.
Byte offset of the given location.
Byte offset of the given location .
pub fn byte_offset_of_location(&self, location:Location)
    -> Result<Bytes,LocationError<Bytes>> {
        let mut column = 0.column();
        let mut offset = self.byte_offset_of_line_index(location.line)?;
        let max_offset = self.end_byte_offset_of_line_index(location.line)?;
        while column < location.column {
            match self.next_grapheme_offset(offset) {
                None      => return Err(LocationError::LineTooShort(offset)),
                Some(off) => {
                    offset  = off;
                    column += 1.column();
                }
            }
        }
        if offset > max_offset {
            Err(LocationError::LineTooShort(max_offset))
        } else {
            Ok(offset)
        }
    }
pub fn byte_offset_of_location ( & self , location : Location ) -> Result < Bytes , LocationError < Bytes > > { let mut column = 0 . column ( ) ; let mut offset = self . byte_offset_of_line_index ( location . line ) ? ; let max_offset = self . end_byte_offset_of_line_index ( location . line ) ? ; while column < location . column { match self . next_grapheme_offset ( offset ) { None => return Err ( LocationError :: LineTooShort ( offset ) ) , Some ( off ) => { offset = off ; column += 1 . column ( ) ; } } } if offset > max_offset { Err ( LocationError :: LineTooShort ( max_offset ) ) } else { Ok ( offset ) } }
Byte offset of the given location.
Byte offset of the given location .
&self
location
Location
&self
location
Location