pub struct Span {
pub start: u32,
pub end: u32,
}Expand description
A half-open span [start, end) within the input stream, stored as byte
offsets.
Use LineIndex (available from crate::node::Document::line_index)
to convert offsets to (line, column) pairs on demand.
Fields§
§start: u32Inclusive start byte offset of the span.
end: u32Exclusive end byte offset of the span.
Implementations§
Source§impl Span
impl Span
Sourcepub fn start_line_column(&self, index: &LineIndex) -> (u32, u32)
pub fn start_line_column(&self, index: &LineIndex) -> (u32, u32)
Return (line, column) for the start of this span.
Line is 1-based; column is 0-based codepoint count from line start.
Sourcepub fn end_line_column(&self, index: &LineIndex) -> (u32, u32)
pub fn end_line_column(&self, index: &LineIndex) -> (u32, u32)
Return (line, column) for the end of this span.
Line is 1-based; column is 0-based codepoint count from line start.
Trait Implementations§
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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