pub struct Span {
pub start: BytePos,
pub end: BytePos,
}
Expand description
Represents a span in a source file, defined by a start and end byte position.
Fields§
§start: BytePos
The position of character at the start of the span
end: BytePos
The position of character at the end of the span
Implementations§
Source§impl Span
impl Span
Sourcepub unsafe fn new_unchecked(start: usize, end: usize) -> Self
pub unsafe fn new_unchecked(start: usize, end: usize) -> Self
Creates a new Span
without bounds checking.
§Safety
It’s the caller’s responsibility to ensure that start
and end
are valid
Sourcepub fn union_span(self, other: Self) -> Self
pub fn union_span(self, other: Self) -> Self
Combines two spans to create a new span that encompasses both.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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