Struct rustc_lexer::Cursor

source ·
pub struct Cursor<'a> {
    len_remaining: usize,
    chars: Chars<'a>,
    prev: char,
}
Expand description

Peekable iterator over a char sequence.

Next characters can be peeked via first method, and position can be shifted forward via bump method.

Fields§

§len_remaining: usize§chars: Chars<'a>

Iterator over chars. Slightly faster than a &str.

§prev: char

Implementations§

Returns the last eaten symbol (or '\0' in release builds). (For debug assertions only.)

Peeks the next symbol from the input stream without consuming it. If requested position doesn’t exist, EOF_CHAR is returned. However, getting EOF_CHAR doesn’t always mean actual end of file, it should be checked with is_eof method.

Peeks the second symbol from the input stream without consuming it.

Checks if there is nothing more to consume.

Returns amount of already consumed symbols.

Resets the number of bytes consumed to 0.

Moves to the next character.

Eats symbols while predicate returns true or until the end of file is reached.

Parses a token from the input string.

Eats double-quoted string and returns true if string is terminated.

Eats the double-quoted string and returns n_hashes and an error if encountered.

Eats the float exponent. Returns true if at least one digit was met, and returns false otherwise.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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: 32 bytes