struct StringReader<'a> {
    sess: &'a ParseSess,
    start_pos: BytePos,
    pos: BytePos,
    end_src_index: usize,
    src: &'a str,
    override_span: Option<Span>,
}

Fields

sess: &'a ParseSessstart_pos: BytePos

Initial position, read-only.

pos: BytePos

The absolute offset within the source_map of the current character.

end_src_index: usize

Stop reading src at this index.

src: &'a str

Source text to tokenize.

override_span: Option<Span>

Implementations

Returns the next token, and info about preceding whitespace, if any.

Report a fatal lexical error with a given span.

Report a lexical error with a given span.

Report a fatal error spanning [from_pos, to_pos).

Report a lexical error spanning [from_pos, to_pos).

Detect usages of Unicode codepoints changing the direction of the text on screen and loudly complain about it.

Turns simple rustc_lexer::TokenKind enum into a rich rustc_ast::TokenKind. This turns strings into interned symbols and runs additional validation.

Slice of the source text from start up to but excluding self.pos, meaning the slice does not include the character self.ch.

As symbol_from, with an explicit endpoint.

Slice of the source text spanning from start up to but excluding end.

Note: It was decided to not add a test case, because it would be too big. https://github.com/rust-lang/rust/pull/50296#issuecomment-392135180

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 56 bytes