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
impl<'input, TF, Tok> TokenFactory<'input> for ArenaFactory<'input, TF, Tok> where
TF: TokenFactory<'input, Tok = Box<Tok>, Inner = Tok>,
Tok: Token<Data = TF::Data> + Clone + TidAble<'input>,
for<'a> &'a Tok: Default,
impl<'input, TF, Tok> TokenFactory<'input> for ArenaFactory<'input, TF, Tok> where
TF: TokenFactory<'input, Tok = Box<Tok>, Inner = Tok>,
Tok: Token<Data = TF::Data> + Clone + TidAble<'input>,
for<'a> &'a Tok: Default,
impl<'input, TF, T> TidAble<'input> for ArenaFactory<'input, TF, T> where
TF: TidAble<'input>,
T: TidAble<'input>,
Auto Trait Implementations
impl<'input, TF, T> !RefUnwindSafe for ArenaFactory<'input, TF, T>
impl<'input, TF, T> Send for ArenaFactory<'input, TF, T> where
T: Send,
TF: Send,
impl<'input, TF, T> !Sync for ArenaFactory<'input, TF, T>
impl<'input, TF, T> Unpin for ArenaFactory<'input, TF, T> where
T: Unpin,
TF: Unpin,
impl<'input, TF, T> UnwindSafe for ArenaFactory<'input, TF, T> where
T: UnwindSafe,
TF: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
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