Struct Span
pub struct Span { pub start: Position, pub end: Position }
Span represents the position information of a single AST item.
All span positions are absolute byte offsets that can be used on the original regular expression that was parsed.
Fields
start: PositionThe start byte offset.
end: PositionThe end byte offset.
Implementations
impl Span
fn new(start: Position, end: Position) -> SpanCreate a new span with the given positions.
fn splat(pos: Position) -> SpanCreate a new span using the given position as the start and end.
fn with_start(self, pos: Position) -> SpanCreate a new span by replacing the starting the position with the one given.
fn with_end(self, pos: Position) -> SpanCreate a new span by replacing the ending the position with the one given.
fn is_one_line(&self) -> boolReturns true if and only if this span occurs on a single line.
fn is_empty(&self) -> boolReturns true if and only if this span is empty. That is, it points to a single position in the concrete syntax of a regular expression.
Trait Implementations
impl Clone for Span
fn clone(&self) -> Self
impl Copy for Span
impl Debug for Span
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Span
impl Ord for Span
fn cmp(&self, other: &Span) -> Ordering
impl PartialEq for Span
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Span
fn partial_cmp(&self, other: &Span) -> Option<Ordering>
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
impl<T> Any for Span
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Span
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Span
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Span
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Span
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Span
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Span
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Span
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Span
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>