pub struct SpanCalculator<'a> { /* private fields */ }
Expand description
Automates the construction of Span
instances for content within a string.
Implementations§
Source§impl<'a> SpanCalculator<'a>
impl<'a> SpanCalculator<'a>
Sourcepub fn new(string: &'a str) -> SpanCalculator<'a>
pub fn new(string: &'a str) -> SpanCalculator<'a>
Creates a new span calculator for locations within the given string.
Sourcepub fn for_line_and_column(
&mut self,
line: usize,
line_utf8_offset: usize,
column_utf8_offset: usize,
) -> Position
pub fn for_line_and_column( &mut self, line: usize, line_utf8_offset: usize, column_utf8_offset: usize, ) -> Position
Constructs a Position
instance for a particular line and column in the string.
You must provide the 0-indexed line number, the byte offset of the line within the string,
and the UTF-8 byte offset of the character within the line.
Sourcepub fn for_line_and_grapheme(
&mut self,
line: usize,
line_utf8_offset: usize,
column_grapheme_offset: usize,
) -> Position
pub fn for_line_and_grapheme( &mut self, line: usize, line_utf8_offset: usize, column_grapheme_offset: usize, ) -> Position
Constructs a Position
instance for a particular line and column in the string.
You must provide the 0-indexed line number, the byte offset of the line within the string,
and the grapheme offset of the character within the line.
Auto Trait Implementations§
impl<'a> Freeze for SpanCalculator<'a>
impl<'a> RefUnwindSafe for SpanCalculator<'a>
impl<'a> Send for SpanCalculator<'a>
impl<'a> Sync for SpanCalculator<'a>
impl<'a> Unpin for SpanCalculator<'a>
impl<'a> UnwindSafe for SpanCalculator<'a>
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