Struct regex_syntax::ast::Position
source · pub struct Position {
pub offset: usize,
pub line: usize,
pub column: usize,
}
Expand description
A single position in a regular expression.
A position encodes one half of a span, and include the byte offset, line number and column number.
Fields§
§offset: usize
The absolute offset of this position, starting at 0
from the
beginning of the regular expression pattern string.
line: usize
The line number, starting at 1
.
column: usize
The approximate column number, starting at 1
.
Implementations§
source§impl Position
impl Position
sourcepub fn new(offset: usize, line: usize, column: usize) -> Position
pub fn new(offset: usize, line: usize, column: usize) -> Position
Create a new position with the given information.
offset
is the absolute offset of the position, starting at 0
from
the beginning of the regular expression pattern string.
line
is the line number, starting at 1
.
column
is the approximate column number, starting at 1
.
Trait Implementations§
source§impl Ord for Position
impl Ord for Position
source§impl PartialEq<Position> for Position
impl PartialEq<Position> for Position
source§impl PartialOrd<Position> for Position
impl PartialOrd<Position> for Position
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 moreimpl Copy for Position
impl Eq for Position
impl StructuralEq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
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