pub struct Span {
pub start: usize,
pub end: usize,
}Expand description
range of a token in the source code
Fields§
§start: usizebyte offset of start position ( inclusive )
end: usizebyte offset of end position ( exclusive )
Implementations§
Source§impl Span
impl Span
pub fn is_empty(&self) -> bool
Sourcepub fn new_single(point: usize) -> Self
pub fn new_single(point: usize) -> Self
create a span that covers a single character
pub fn new(start: usize, end: usize) -> Self
Sourcepub fn merge(&self, other: &Self) -> Self
pub fn merge(&self, other: &Self) -> Self
merge two spans into one. the new span will cover both of the original spans.
Sourcepub fn merge_ordered(&self, right: &Self) -> Self
pub fn merge_ordered(&self, right: &Self) -> Self
merge two spans into one. the new span will cover both of the original spans.
Trait Implementations§
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
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