pub struct Span {
pub start: Position,
pub end: Position,
}Expand description
Span represents the position information of a single token.
All span positions are absolute char offsets that can be used on the original tree that was parsed.
Fields§
§start: PositionThe start char offset.
end: PositionThe end char offset.
Implementations§
Source§impl Span
impl Span
Sourcepub const fn new(start: Position, end: Position) -> Self
pub const fn new(start: Position, end: Position) -> Self
Create a new span with the given positions.
Sourcepub const fn splat(pos: Position) -> Self
pub const fn splat(pos: Position) -> Self
Create a new span using the given position as the start and end.
Sourcepub const fn with_start(self, pos: Position) -> Self
pub const fn with_start(self, pos: Position) -> Self
Create a new span by replacing the starting position with the one given.
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