Struct parse_js::source::SourceRange
source · pub struct SourceRange<'a> { /* private fields */ }
Expand description
A string backed by a source. Treated as a string, so contents rather than position is considered the value (and this is used for equality). However, it’s illegal to add two SourceRange values from different sources.
Implementations§
source§impl<'a> SourceRange<'a>
impl<'a> SourceRange<'a>
pub fn new(source: &'a [u8], start: usize, end: usize) -> SourceRange<'a>
pub fn from_slice(source: &'a [u8]) -> SourceRange<'a>
pub fn start(&self) -> usize
pub fn end(&self) -> usize
pub fn at_start(&self) -> SourceRange<'a>
pub fn at_end(&self) -> SourceRange<'a>
pub fn error( self, typ: SyntaxErrorType, actual_token: Option<TokenType> ) -> SyntaxError<'a>
pub fn add_option(self, rhs: Option<SourceRange<'a>>) -> SourceRange<'a>
pub fn is_empty(&self) -> bool
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_str(&self) -> &str
pub fn len(&self) -> usize
pub fn extend(&mut self, other: SourceRange<'_>)
Trait Implementations§
source§impl<'a> Add<SourceRange<'a>> for SourceRange<'a>
impl<'a> Add<SourceRange<'a>> for SourceRange<'a>
source§impl<'a> AddAssign<SourceRange<'a>> for SourceRange<'a>
impl<'a> AddAssign<SourceRange<'a>> for SourceRange<'a>
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl<'a> Clone for SourceRange<'a>
impl<'a> Clone for SourceRange<'a>
source§fn clone(&self) -> SourceRange<'a>
fn clone(&self) -> SourceRange<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more