pub struct StreamPosition { /* private fields */ }
Expand description
This representes the position of a character within a UTF8 stream
Implementations§
Source§impl StreamPosition
impl StreamPosition
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new StreamPosition for the default of byte 0, first line, first character
Sourcepub fn of_blc(byte: usize, line_num: usize, char_ofs: usize) -> Self
pub fn of_blc(byte: usize, line_num: usize, char_ofs: usize) -> Self
Construct a new StreamPosition from byte, line and character offset
Sourcepub fn byte(&self) -> usize
pub fn byte(&self) -> usize
Find the byte that the StreamPosition holds
Sourcepub fn line_position(&self) -> (usize, usize)
pub fn line_position(&self) -> (usize, usize)
Get the line number and character within the line of the StreamPosition
Trait Implementations§
Source§impl Clone for StreamPosition
impl Clone for StreamPosition
Source§fn clone(&self) -> StreamPosition
fn clone(&self) -> StreamPosition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StreamPosition
impl Debug for StreamPosition
Source§impl Display for StreamPosition
impl Display for StreamPosition
Source§impl Hash for StreamPosition
impl Hash for StreamPosition
Source§impl PartialEq for StreamPosition
impl PartialEq for StreamPosition
impl Copy for StreamPosition
impl Eq for StreamPosition
impl StructuralPartialEq for StreamPosition
Auto Trait Implementations§
impl Freeze for StreamPosition
impl RefUnwindSafe for StreamPosition
impl Send for StreamPosition
impl Sync for StreamPosition
impl Unpin for StreamPosition
impl UnwindSafe for StreamPosition
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