Struct antlr_rust::token_factory::ArenaFactory[][src]

pub struct ArenaFactory<'input, TF, T> { /* fields omitted */ }
Expand description

This is a wrapper for Token factory that allows to allocate tokens in separate arena. It can allow to significantly improve performance by passing Tokens by references everywhere.

Requires &'a Tok: Default bound to produce invalid tokens, which can be easily implemented like this:

lazy_static!{ static ref INVALID_TOKEN:Box<CustomToken> = ... }
impl Default for &'_ CustomToken {
    fn default() -> Self { &**INVALID_TOKEN }
}

or if possible just

const INVALID_TOKEN:CustomToken = ...

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Type of tokens emitted by this factory.

Ownership of the emitted tokens

Type of the underlying storage

Type of the CharStream that factory can produce tokens from

Creates token either from sourse or from pure data in text Either source or text are not None Read more

Creates invalid token Invalid tokens must have TOKEN_INVALID_TYPE token type. Read more

Creates Self::Data representation for from for lexer to work with when it does not need to create full token Read more

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.

Returns text representation of current node type, rule name for context nodes and token text for terminal nodes Read more

Returns type id of the type of self Read more

Returns type id of this type

Returns true if type behind self is equal to the type of T.

Attempts to downcast self to T behind reference

Attempts to downcast self to T behind mutable reference

Attempts to downcast self to T behind Rc pointer

Attempts to downcast self to T behind Arc pointer

Attempts to downcast self to T behind Box pointer

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.