[][src]Struct rhai::Position

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]

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 Clone for Position[src]

impl Copy for Position[src]

impl Debug for Position[src]

impl Default for Position[src]

impl Display for Position[src]

impl Eq for Position[src]

impl Hash for Position[src]

impl Ord for Position[src]

impl PartialEq<Position> for Position[src]

impl PartialOrd<Position> for Position[src]

impl StructuralEq for Position[src]

impl StructuralPartialEq for Position[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.