pub struct Position {
pub start: u32,
pub end: u32,
}Expand description
A position or span of text in the source code.
Fields§
§start: u32The starting index of the position, byte-wise. This is inclusive.
end: u32The ending index of the position, byte-wise. This is exclusive.
Implementations§
Source§impl Position
impl Position
Sourcepub fn new(start: usize, end: usize) -> Self
pub fn new(start: usize, end: usize) -> Self
Creates a new position from a start and end index.
Sourcepub fn starting_char(&self) -> usize
pub fn starting_char(&self) -> usize
Returns the starting index of the position.
Sourcepub fn ending_char(&self) -> usize
pub fn ending_char(&self) -> usize
Returns the ending index of the position. Note that this is exclusive, so
self.end - 1 is the last index of the position.
Trait Implementations§
Source§impl From<Position> for SourceSpan
Creates a miette::SourceSpan from a Position.
impl From<Position> for SourceSpan
Creates a miette::SourceSpan from a Position.
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
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