pub struct Spans<'a> { /* private fields */ }Expand description
Zero-copy span utilities for AST node validation and manipulation
Provides safe methods to work with string slices that reference the original source text, maintaining zero-copy semantics.
Implementations§
Source§impl<'a> Spans<'a>
impl<'a> Spans<'a>
Sourcepub fn validate_span(&self, span: &str) -> bool
pub fn validate_span(&self, span: &str) -> bool
Validate that a span references this source text
Returns true if the span is a valid substring of the source.
Used for debug assertions to ensure zero-copy invariants.
Sourcepub fn span_offset(&self, span: &str) -> Option<usize>
pub fn span_offset(&self, span: &str) -> Option<usize>
Get byte offset of span within source
Sourcepub fn span_column(&self, span: &str) -> Option<usize>
pub fn span_column(&self, span: &str) -> Option<usize>
Get column number (1-based) for a span
Trait Implementations§
impl<'a> Copy for Spans<'a>
impl<'a> Eq for Spans<'a>
impl<'a> StructuralPartialEq for Spans<'a>
Auto Trait Implementations§
impl<'a> Freeze for Spans<'a>
impl<'a> RefUnwindSafe for Spans<'a>
impl<'a> Send for Spans<'a>
impl<'a> Sync for Spans<'a>
impl<'a> Unpin for Spans<'a>
impl<'a> UnwindSafe for Spans<'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