pub struct Span {
pub start: Position,
pub end: Position,
}
Expand description
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: Position
The start byte offset.
end: Position
The end byte offset.
Implementations§
Source§impl Span
impl Span
Sourcepub fn splat(pos: Position) -> Span
pub fn splat(pos: Position) -> Span
Create a new span using the given position as the start and end.
Sourcepub fn with_start(self, pos: Position) -> Span
pub fn with_start(self, pos: Position) -> Span
Create a new span by replacing the starting the position with the one given.
Sourcepub fn with_end(self, pos: Position) -> Span
pub fn with_end(self, pos: Position) -> Span
Create a new span by replacing the ending the position with the one given.
Sourcepub fn is_one_line(&self) -> bool
pub fn is_one_line(&self) -> bool
Returns true if and only if this span occurs on a single line.
Trait Implementations§
Source§impl Ord for Span
impl Ord for Span
Source§impl PartialOrd for Span
impl PartialOrd for Span
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)