pub struct DiagnosticSpan { /* private fields */ }Expand description
A generic source span with optional source identity.
Implementations§
Source§impl DiagnosticSpan
impl DiagnosticSpan
Sourcepub fn new(
source: Option<DiagnosticSourceId>,
start: DiagnosticPosition,
end: DiagnosticPosition,
) -> Result<Self, DiagnosticSpanError>
pub fn new( source: Option<DiagnosticSourceId>, start: DiagnosticPosition, end: DiagnosticPosition, ) -> Result<Self, DiagnosticSpanError>
Creates a diagnostic span and validates that the end is not before the start.
§Errors
Returns DiagnosticSpanError::Reversed when end is before start.
Sourcepub fn with_source(
source: DiagnosticSourceId,
start: DiagnosticPosition,
end: DiagnosticPosition,
) -> Result<Self, DiagnosticSpanError>
pub fn with_source( source: DiagnosticSourceId, start: DiagnosticPosition, end: DiagnosticPosition, ) -> Result<Self, DiagnosticSpanError>
Creates a span with a source identifier.
§Errors
Returns DiagnosticSpanError::Reversed when end is before start.
Sourcepub fn without_source(
start: DiagnosticPosition,
end: DiagnosticPosition,
) -> Result<Self, DiagnosticSpanError>
pub fn without_source( start: DiagnosticPosition, end: DiagnosticPosition, ) -> Result<Self, DiagnosticSpanError>
Creates a span without a source identifier.
§Errors
Returns DiagnosticSpanError::Reversed when end is before start.
Sourcepub const fn source(&self) -> Option<&DiagnosticSourceId>
pub const fn source(&self) -> Option<&DiagnosticSourceId>
Returns the optional source identifier.
Sourcepub const fn start(&self) -> DiagnosticPosition
pub const fn start(&self) -> DiagnosticPosition
Returns the start position.
Sourcepub const fn end(&self) -> DiagnosticPosition
pub const fn end(&self) -> DiagnosticPosition
Returns the end position.
Trait Implementations§
Source§impl Clone for DiagnosticSpan
impl Clone for DiagnosticSpan
Source§fn clone(&self) -> DiagnosticSpan
fn clone(&self) -> DiagnosticSpan
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 moreSource§impl Debug for DiagnosticSpan
impl Debug for DiagnosticSpan
Source§impl Hash for DiagnosticSpan
impl Hash for DiagnosticSpan
Source§impl PartialEq for DiagnosticSpan
impl PartialEq for DiagnosticSpan
impl Eq for DiagnosticSpan
impl StructuralPartialEq for DiagnosticSpan
Auto Trait Implementations§
impl Freeze for DiagnosticSpan
impl RefUnwindSafe for DiagnosticSpan
impl Send for DiagnosticSpan
impl Sync for DiagnosticSpan
impl Unpin for DiagnosticSpan
impl UnsafeUnpin for DiagnosticSpan
impl UnwindSafe for DiagnosticSpan
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