Struct lamcal::CharPosition [−][src]
pub struct CharPosition { /* fields omitted */ }
Represents a position in a stream of char
s.
The first character in a stream is at line 1 and column 1. Every newline character advances the line by 1 and resets the column so that the next character gets column 1 at the next line.
Methods
impl CharPosition
[src]
impl CharPosition
pub fn new(line: usize, column: usize) -> Self
[src]
pub fn new(line: usize, column: usize) -> Self
Constructs a new CharPosition
with given line and column number.
pub fn with_newline(line: usize, column: usize, newline: bool) -> Self
[src]
pub fn with_newline(line: usize, column: usize, newline: bool) -> Self
Constructs a new CharPosition
with given line and column number and
an indicator, that the next character is positioned at a new line.
pub fn line(&self) -> usize
[src]
pub fn line(&self) -> usize
Returns the line number of this position.
pub fn column(&self) -> usize
[src]
pub fn column(&self) -> usize
Returns the column number of this position.
pub fn newline(&self) -> bool
[src]
pub fn newline(&self) -> bool
Returns the newline indicator of this position.
pub fn next(&mut self, chr: char)
[src]
pub fn next(&mut self, chr: char)
Advances this position to the next character.
The first character in a stream is at line 1 and column 1. Every newline character advances the line by 1 and resets the column so that the next character gets column 1 at the next line.
Trait Implementations
impl Debug for CharPosition
[src]
impl Debug for CharPosition
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for CharPosition
[src]
impl Clone for CharPosition
fn clone(&self) -> CharPosition
[src]
fn clone(&self) -> CharPosition
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for CharPosition
[src]
impl Copy for CharPosition
impl PartialEq for CharPosition
[src]
impl PartialEq for CharPosition
fn eq(&self, other: &CharPosition) -> bool
[src]
fn eq(&self, other: &CharPosition) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &CharPosition) -> bool
[src]
fn ne(&self, other: &CharPosition) -> bool
This method tests for !=
.
impl Eq for CharPosition
[src]
impl Eq for CharPosition
impl Hash for CharPosition
[src]
impl Hash for CharPosition
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for CharPosition
[src]
impl Default for CharPosition
impl Display for CharPosition
[src]
impl Display for CharPosition
Auto Trait Implementations
impl Send for CharPosition
impl Send for CharPosition
impl Sync for CharPosition
impl Sync for CharPosition