pub struct Span {
pub source: Source,
pub begin: usize,
pub end: usize,
}
Expand description
A span of locations within a source file, expressed as a half-open interval
of bytes [begin,end)
.
Fields§
§source: Source
§begin: usize
§end: usize
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(source: Source, begin: usize, end: usize) -> Span
pub fn new(source: Source, begin: usize, end: usize) -> Span
Create a new span from two byte offsets.
Sourcepub fn union<S: Into<Span>>(a: S, b: S) -> Span
pub fn union<S: Into<Span>>(a: S, b: S) -> Span
Create a new span that covers two spans, i.e. represents the smallest
possible span that fully contains both input spans a
and b
.
Sourcepub fn expand<S: Into<Span>>(&mut self, other: S) -> &mut Self
pub fn expand<S: Into<Span>>(&mut self, other: S) -> &mut Self
Modify this range to also cover the entirety of the other
range. The
other
range must lie in the same source as self
.
Sourcepub fn begin(&self) -> Location
pub fn begin(&self) -> Location
Return the location just before the first character in this span.
Trait Implementations§
Source§impl Ord for Span
impl Ord for Span
Source§impl PartialOrd for Span
impl PartialOrd for Span
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