Struct regex_syntax::ast::Span
source · 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 PartialEq<Span> for Span
impl PartialEq<Span> for Span
source§impl PartialOrd<Span> for Span
impl PartialOrd<Span> for Span
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more