pub struct Position { /* private fields */ }
Expand description
Position represents the location within an Ion stream where an error has been
identified. For all formats byte_offset
will contain the number of bytes into the stream
that have been processed prior to encountering the error. When working with the text format,
line_column
will be updated to contain the line and column as well.
Implementations§
source§impl Position
impl Position
sourcepub fn with_offset(offset: usize) -> Self
pub fn with_offset(offset: usize) -> Self
Creates a new Position with the provided offset in bytes.
Line and Column offsets can be added using Self::with_text_position()
.
sourcepub fn with_text_position(&self, line: usize, column: usize) -> Self
pub fn with_text_position(&self, line: usize, column: usize) -> Self
Add line and column information to the current Position.
sourcepub fn byte_offset(&self) -> usize
pub fn byte_offset(&self) -> usize
Returns the offset from the start of the Ion stream in bytes.
sourcepub fn text_position(&self) -> Option<(usize, usize)>
pub fn text_position(&self) -> Option<(usize, usize)>
If available returns the text position as line and column offsets.
sourcepub fn line(&self) -> Option<usize>
pub fn line(&self) -> Option<usize>
If available returns the line component of the text position.
sourcepub fn column(&self) -> Option<usize>
pub fn column(&self) -> Option<usize>
If available returns the column component of the text position.
sourcepub fn has_text_position(&self) -> bool
pub fn has_text_position(&self) -> bool
Returns true if the current Position contains line and column offsets.