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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes