pub struct SourceSpan { /* private fields */ }
Expand description
Span within a SourceCode
Implementations§
Source§impl SourceSpan
impl SourceSpan
Sourcepub const fn new(start: SourceOffset, length: SourceOffset) -> SourceSpan
pub const fn new(start: SourceOffset, length: SourceOffset) -> SourceSpan
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, SourceOffset)> for SourceSpan
impl From<(SourceOffset, SourceOffset)> for SourceSpan
Source§fn from(_: (SourceOffset, SourceOffset)) -> SourceSpan
fn from(_: (SourceOffset, SourceOffset)) -> SourceSpan
Converts to this type from the input type.
Source§impl From<Label> for SourceSpan
impl From<Label> for SourceSpan
Source§fn from(label: Label) -> SourceSpan
fn from(label: Label) -> SourceSpan
Converts to this type from the input type.
Source§impl From<SourceOffset> for SourceSpan
impl From<SourceOffset> for SourceSpan
Source§fn from(offset: SourceOffset) -> SourceSpan
fn from(offset: SourceOffset) -> SourceSpan
Converts to this type from the input type.
Source§impl From<SourceSpan> for Range<usize>
impl From<SourceSpan> for Range<usize>
Source§fn from(span: SourceSpan) -> Self
fn from(span: SourceSpan) -> Self
Converts to this type from the input type.
Source§impl From<usize> for SourceSpan
impl From<usize> for SourceSpan
Source§fn from(offset: usize) -> SourceSpan
fn from(offset: usize) -> SourceSpan
Converts to this type from the input type.
Source§impl Hash for SourceSpan
impl Hash for SourceSpan
Source§impl PartialEq for SourceSpan
impl PartialEq for SourceSpan
Source§impl Spanned for SourceSpan
impl Spanned 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> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more