pub trait NonStreamingLexer<'input, LexerTypesT: LexerTypes>: Lexer<LexerTypesT>{
// Required methods
fn span_str(&self, span: Span) -> &'input str;
fn span_lines_str(&self, span: Span) -> &'input str;
fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize));
}Expand description
A NonStreamingLexer is one that takes input in one go, and is then able to hand out
substrings to that input and calculate line and column numbers from a Span.
Required Methods§
Sourcefn span_str(&self, span: Span) -> &'input str
fn span_str(&self, span: Span) -> &'input str
Return the user input associated with a Span.
The Span must be well formed:
- The start/end byte indexes must be valid UTF-8 character indexes.
- The end byte index must not exceed the input’s length.
If these requirements are not respected this function may panic or return unexpected portions of the input.
Sourcefn span_lines_str(&self, span: Span) -> &'input str
fn span_lines_str(&self, span: Span) -> &'input str
Return the lines containing the input at span (including all the text on the lines
that span starts and ends on).
The Span must be well formed:
- The start/end byte indexes must be valid UTF-8 character indexes.
- The end byte index must not exceed the input’s length.
If these requirements are not respected this function may panic or return unexpected portions of the input.
Sourcefn line_col(&self, span: Span) -> ((usize, usize), (usize, usize))
fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize))
Return ((start line, start column), (end line, end column)) for span. Note that column
characters (not bytes) are returned.
The Span must be well formed:
- The start/end byte indexes must be valid UTF-8 character indexes.
- The end byte index must not exceed the input’s length.
If these requirements are not respected this function may panic or return unexpected portions of the input.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".