Struct rhai::Position [−][src]
pub struct Position { /* fields omitted */ }
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
impl Position
[src]
impl Position
[src]pub const NONE: Self
[src]
A Position
representing no position.
pub const START: Self
[src]
A Position
representing the first position.
pub fn new(line: u16, _position: u16) -> Self
[src]
Create a new Position
.
line
must not be zero.
If Position
is zero, then it is at the beginning of a line.
Panics
Panics if line
is zero.
pub fn line(self) -> Option<usize>
[src]
Get the line number (1-based), or None
if there is no position.
pub fn position(self) -> Option<usize>
[src]
Get the character position (1-based), or None
if at beginning of a line.
pub fn is_beginning_of_line(self) -> bool
[src]
Is this Position
at the beginning of a line?
pub fn is_none(self) -> bool
[src]
Is there no Position
?
Trait Implementations
impl PartialOrd<Position> for Position
[src]
impl PartialOrd<Position> for Position
[src]impl StructuralEq for Position
[src]
impl StructuralEq for Position
[src]impl StructuralPartialEq for Position
[src]
impl StructuralPartialEq for Position
[src]Auto Trait Implementations
impl RefUnwindSafe for Position
impl RefUnwindSafe for Position
impl UnwindSafe for Position
impl UnwindSafe for Position