Struct Position
pub struct Position { pub offset: usize, pub line: usize, pub column: usize }
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: usizeThe absolute offset of this position, starting at
0from the beginning of the regular expression pattern string.line: usizeThe line number, starting at
1.column: usizeThe approximate column number, starting at
1.
Implementations
impl Position
fn new(offset: usize, line: usize, column: usize) -> PositionCreate a new position with the given information.
offsetis the absolute offset of the position, starting at0from the beginning of the regular expression pattern string.lineis the line number, starting at1.columnis the approximate column number, starting at1.
Trait Implementations
impl Clone for Position
fn clone(&self) -> Self
impl Copy for Position
impl Debug for Position
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Position
impl Ord for Position
fn cmp(&self, other: &Position) -> Ordering
impl PartialEq for Position
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Position
fn partial_cmp(&self, other: &Position) -> Option<Ordering>
impl StructuralPartialEq for Position
Auto Trait Implementations
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
Blanket Implementations
impl<T> Any for Position
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Position
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Position
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Position
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Position
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Position
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Position
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Position
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Position
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>