pub struct Pos {
pub byte_offset: usize,
pub char_offset: usize,
pub line: usize,
pub column: usize,
}Expand description
A position within the input stream.
line is 1-based; column is 0-based.
Fields§
§byte_offset: usize§char_offset: usize§line: usize§column: usizeImplementations§
Source§impl Pos
impl Pos
Sourcepub const fn advance(self, ch: char) -> Self
pub const fn advance(self, ch: char) -> Self
Advance the position by one character.
If ch is a line feed (\n) the line counter is incremented and the
column is reset to 0. For all other characters the column advances by
one. byte_offset advances by ch.len_utf8() and char_offset
always advances by 1.
Trait Implementations§
impl Copy for Pos
impl Eq for Pos
impl StructuralPartialEq for Pos
Auto Trait Implementations§
impl Freeze for Pos
impl RefUnwindSafe for Pos
impl Send for Pos
impl Sync for Pos
impl Unpin for Pos
impl UnsafeUnpin for Pos
impl UnwindSafe for Pos
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