pub struct SourceSpan { /* private fields */ }Expand description
A byte-exact source span with one-based line and column positions.
Implementations§
Source§impl SourceSpan
impl SourceSpan
Sourcepub fn new(
document: DocumentId,
byte_start: u64,
byte_end: u64,
line: u32,
column: u32,
end_line: u32,
end_column: u32,
) -> Result<Self, Diagnostic>
pub fn new( document: DocumentId, byte_start: u64, byte_end: u64, line: u32, column: u32, end_line: u32, end_column: u32, ) -> Result<Self, Diagnostic>
Construct a validated source span.
Sourcepub fn document(&self) -> &DocumentId
pub fn document(&self) -> &DocumentId
Return the source document identifier.
Sourcepub const fn byte_start(&self) -> u64
pub const fn byte_start(&self) -> u64
Return the inclusive byte start.
Sourcepub const fn end_column(&self) -> u32
pub const fn end_column(&self) -> u32
Return the one-based end column.
Trait Implementations§
Source§impl Clone for SourceSpan
impl Clone for SourceSpan
Source§fn clone(&self) -> SourceSpan
fn clone(&self) -> SourceSpan
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SourceSpan
impl Debug for SourceSpan
impl Eq for SourceSpan
Source§impl Hash for SourceSpan
impl Hash for SourceSpan
Source§impl Ord for SourceSpan
impl Ord for SourceSpan
Source§fn cmp(&self, other: &SourceSpan) -> Ordering
fn cmp(&self, other: &SourceSpan) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for SourceSpan
impl PartialEq for SourceSpan
Source§impl PartialOrd for SourceSpan
impl PartialOrd for SourceSpan
Source§impl Serialize for SourceSpan
impl Serialize for SourceSpan
impl StructuralPartialEq for SourceSpan
Auto Trait Implementations§
impl Freeze for SourceSpan
impl RefUnwindSafe for SourceSpan
impl Send for SourceSpan
impl Sync for SourceSpan
impl Unpin for SourceSpan
impl UnsafeUnpin for SourceSpan
impl UnwindSafe for SourceSpan
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