pub struct Position { /* private fields */ }
Expand description
A location (line number + character position) in the input script.
Limitations
In order to keep footprint small, both line number and character position have 16-bit resolution, meaning they go up to a maximum of 65,535 lines and 65,535 characters per line.
Advancing beyond the maximum line length or maximum number of lines is not an error but has no effect.
Implementations§
source§impl Position
impl Position
sourcepub const fn new_const(line: u16, position: u16) -> Option<Self>
👎Deprecated since 1.6.0: use <code>new</code> instead
pub const fn new_const(line: u16, position: u16) -> Option<Self>
Create a new Position
.
If line
is zero, then None
is returned.
If position
is zero, then it is at the beginning of a line.
Deprecated
This function is deprecated. Use new
(which panics when line
is zero) instead.
This method will be removed in the next major version.
source§impl Position
impl Position
sourcepub const fn is_beginning_of_line(self) -> bool
pub const fn is_beginning_of_line(self) -> bool
Is this Position
at the beginning of a line?
Always returns false
under no_position
.
Trait Implementations§
source§impl AddAssign<Position> for Position
impl AddAssign<Position> for Position
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§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 more