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 for SourceRange<'a>
impl<'a> Add for SourceRange<'a>
source§impl<'a> AddAssign for SourceRange<'a>
impl<'a> AddAssign 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 moresource§impl<'a> Debug for SourceRange<'a>
impl<'a> Debug for SourceRange<'a>
source§impl<'a> Display for SourceRange<'a>
impl<'a> Display for SourceRange<'a>
source§impl<'a> Hash for SourceRange<'a>
impl<'a> Hash for SourceRange<'a>
source§impl<'a> Index<SourceRange<'a>> for Lexer<'a>
impl<'a> Index<SourceRange<'a>> for Lexer<'a>
source§impl<'a> PartialEq<&[u8]> for SourceRange<'a>
impl<'a> PartialEq<&[u8]> for SourceRange<'a>
source§impl<'a> PartialEq<&str> for SourceRange<'a>
impl<'a> PartialEq<&str> for SourceRange<'a>
source§impl<'a> PartialEq for SourceRange<'a>
impl<'a> PartialEq for SourceRange<'a>
impl<'a> Copy for SourceRange<'a>
impl<'a> Eq for SourceRange<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for SourceRange<'a>
impl<'a> !Send for SourceRange<'a>
impl<'a> !Sync for SourceRange<'a>
impl<'a> Unpin for SourceRange<'a>
impl<'a> UnwindSafe for SourceRange<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more