pub struct Span {
pub start: u32,
pub end: u32,
}Expand description
A half open byte range [start, end) into one source file.
Fields§
§start: u32§end: u32Implementations§
Source§impl Span
impl Span
Sourcepub fn new(start: u32, end: u32) -> Self
pub fn new(start: u32, end: u32) -> Self
Creates a span covering [start, end).
§Panics
Panics if end < start. A reversed span is always a bug in the caller
rather than something to recover from.
pub fn is_empty(self) -> bool
pub fn contains(self, offset: u32) -> bool
pub fn as_range(self) -> Range<usize> ⓘ
Trait Implementations§
impl Copy for Span
impl Eq for Span
Source§impl Ord for Span
impl Ord for Span
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Span
impl PartialOrd 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