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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)