pub struct SourceSpan { /* private fields */ }
Expand description
Span within a SourceCode
Implementations§
Source§impl SourceSpan
impl SourceSpan
Sourcepub const fn new(start: SourceOffset, length: usize) -> Self
pub const fn new(start: SourceOffset, length: usize) -> Self
Create a new SourceSpan
.
Sourcepub const fn offset(&self) -> usize
pub const fn offset(&self) -> usize
The absolute offset, in bytes, from the beginning of a SourceCode
.
Sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Total length of the SourceSpan
, in bytes.
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Whether this SourceSpan
has a length of zero. It may still be useful
to point to a specific point.
Trait Implementations§
Source§impl Clone for SourceSpan
impl Clone for SourceSpan
Source§fn clone(&self) -> SourceSpan
fn clone(&self) -> SourceSpan
Returns a copy 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 SourceSpan
impl Debug for SourceSpan
Source§impl From<(SourceOffset, usize)> for SourceSpan
impl From<(SourceOffset, usize)> for SourceSpan
Source§fn from((start, len): (SourceOffset, usize)) -> Self
fn from((start, len): (SourceOffset, usize)) -> Self
Converts to this type from the input type.
Source§impl From<(usize, usize)> for SourceSpan
impl From<(usize, usize)> for SourceSpan
Source§fn from((start, len): (ByteOffset, usize)) -> Self
fn from((start, len): (ByteOffset, usize)) -> Self
Converts to this type from the input type.
Source§impl From<Range<usize>> for SourceSpan
impl From<Range<usize>> for SourceSpan
Source§fn from(range: Range<ByteOffset>) -> Self
fn from(range: Range<ByteOffset>) -> Self
Converts to this type from the input type.
Source§impl From<SourceOffset> for SourceSpan
impl From<SourceOffset> for SourceSpan
Source§fn from(offset: SourceOffset) -> Self
fn from(offset: SourceOffset) -> Self
Converts to this type from the input type.
Source§impl From<usize> for SourceSpan
impl From<usize> for SourceSpan
Source§fn from(offset: ByteOffset) -> Self
fn from(offset: ByteOffset) -> Self
Converts to this type from the input type.
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 · 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
Source§impl PartialEq for SourceSpan
impl PartialEq for SourceSpan
Source§impl PartialOrd for SourceSpan
impl PartialOrd for SourceSpan
impl Copy for SourceSpan
impl Eq 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 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