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 new instead
pub const fn new_const(line: u16, position: u16) -> Option<Self>
new insteadCreate 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 for Position
impl AddAssign 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 for Position
impl PartialEq for Position
source§impl PartialOrd for Position
impl PartialOrd 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
source§impl<T> Variant for Twhere
T: Any + Clone + SendSync,
impl<T> Variant for Twhere T: Any + Clone + SendSync,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this
Variant trait object to &mut dyn Any.source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this
Variant trait object to Box<dyn Any>.