pub struct PositionTracker<'a> { /* private fields */ }Expand description
Tracks current position in source text with line/column information
Implementations§
Source§impl<'a> PositionTracker<'a>
impl<'a> PositionTracker<'a>
Sourcepub const fn new_at(
source: &'a str,
offset: usize,
line: u32,
column: u32,
) -> Self
pub const fn new_at( source: &'a str, offset: usize, line: u32, column: u32, ) -> Self
Create a tracker starting at a specific position
Sourcepub fn advance_to(&mut self, target_offset: usize)
pub fn advance_to(&mut self, target_offset: usize)
Advance to a specific byte offset
Sourcepub fn skip_whitespace(&mut self)
pub fn skip_whitespace(&mut self)
Skip whitespace and update position
Sourcepub const fn span_from(&self, start: &PositionTracker<'_>) -> Span
pub const fn span_from(&self, start: &PositionTracker<'_>) -> Span
Create a span from a start position to current position
Sourcepub const fn span_for(&self, length: usize) -> Span
pub const fn span_for(&self, length: usize) -> Span
Create a span for a range of bytes from current position
Sourcepub const fn checkpoint(&self) -> Self
pub const fn checkpoint(&self) -> Self
Clone current position state
Trait Implementations§
Source§impl<'a> Clone for PositionTracker<'a>
impl<'a> Clone for PositionTracker<'a>
Source§fn clone(&self) -> PositionTracker<'a>
fn clone(&self) -> PositionTracker<'a>
Returns a duplicate 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 moreAuto Trait Implementations§
impl<'a> Freeze for PositionTracker<'a>
impl<'a> RefUnwindSafe for PositionTracker<'a>
impl<'a> Send for PositionTracker<'a>
impl<'a> Sync for PositionTracker<'a>
impl<'a> Unpin for PositionTracker<'a>
impl<'a> UnwindSafe for PositionTracker<'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