Struct pomsky_syntax::Span
source · [−]pub struct Span { /* private fields */ }
Expand description
A source code location, marked by the start and end byte offset. If both are zero,
this is considered as “empty” or “missing”, and Span::range
returns None
.
Implementations
sourceimpl Span
impl Span
sourcepub fn new(start: usize, end: usize) -> Self
pub fn new(start: usize, end: usize) -> Self
Constructs a new Span
. If both start
and end
is 0, this is
considered as “empty” or “missing”
sourcepub fn range(self) -> Option<Range<usize>>
pub fn range(self) -> Option<Range<usize>>
Converts this span to a std::ops::Range
. If it is empty, None
is returned.
sourcepub fn range_unchecked(self) -> Range<usize>
pub fn range_unchecked(self) -> Range<usize>
Converts this span to a std::ops::Range
, without checking if it is empty.
Trait Implementations
sourceimpl PartialEq<Span> for Span
impl PartialEq<Span> for Span
impl Copy for Span
impl Eq for Span
impl StructuralEq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more