Enum syntax::parse::parser::LastToken[][src]

enum LastToken {
    Collecting(Vec<TokenTree>),
    Was(Option<TokenTree>),
}
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

This is used in TokenCursorFrame above to track tokens that are consumed by the parser, and then that's transitively used to record the tokens that each parse AST item is created with.

Right now this has two states, either collecting tokens or not collecting tokens. If we're collecting tokens we just save everything off into a local Vec. This should eventually though likely save tokens from the original token stream and just use slicing of token streams to avoid creation of a whole new vector.

The second state is where we're passively not recording tokens, but the last token is still tracked for when we want to start recording tokens. This "last token" means that when we start recording tokens we'll want to ensure that this, the first token, is included in the output.

You can find some more example usage of this in the collect_tokens method on the parser.

Variants

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Trait Implementations

impl Clone for LastToken
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for LastToken

impl !Sync for LastToken