pub struct Span {
pub lo: BytePos,
pub hi: BytePos,
}Expand description
A span of source code, represented as a half-open byte range [lo, hi).
Fields§
§lo: BytePosThe start of the span (inclusive).
hi: BytePosThe end of the span (exclusive).
Implementations§
Source§impl Span
impl Span
Sourcepub const fn to(self, other: Self) -> Self
pub const fn to(self, other: Self) -> Self
Create a span that covers from the start of self to the end of other.
Sourcepub const fn shrink_to_lo(self) -> Self
pub const fn shrink_to_lo(self) -> Self
Shrink the span to a single point at the start.
Sourcepub const fn shrink_to_hi(self) -> Self
pub const fn shrink_to_hi(self) -> Self
Shrink the span to a single point at the end.
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
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 UnsafeUnpin 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