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

pub struct ArenaFactory<'input, TF, T> where
    TF: TokenFactory<'input, Tok = Box<T>, Inner = T>,
    T: Token<Data = TF::Data> + Clone + 'input, 
{ /* fields omitted */ }

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:CustomToken = ... }
impl Default for &'_ CustomToken {
    fn default() -> Self { &**INVALID_TOKEN }
}

Trait Implementations

impl<'input, TF, T> Default for ArenaFactory<'input, TF, T> where
    TF: TokenFactory<'input, Tok = Box<T>, Inner = T> + Default,
    T: Token<Data = TF::Data> + Clone + 'input, 
[src]

impl<'input, TF, T> TidAble<'input> for ArenaFactory<'input, TF, T> where
    TF: TokenFactory<'input, Tok = Box<T>, Inner = T>,
    T: Token<Data = TF::Data> + Clone + 'input,
    TF: TidAble<'input>,
    T: TidAble<'input>, 
[src]

type Static = __ArenaFactoryinputTFT_should_never_exist<TF::Static, T::Static>

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>,
    &'a Tok: Default
[src]

type Inner = Tok

type of tokens emitted by this factory

type Tok = &'input Tok

ownership of the emitted tokens

type Data = TF::Data

type of the underlying storage

type From = TF::From

type of the reference to Self::Data that factory needs for producing tokens

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NodeText for T[src]

impl<'input, T> NodeText for T where
    T: CustomRuleContext<'input>, 
[src]

impl<'a, T> Tid<'a> for T where
    T: TidAble<'a> + ?Sized
[src]

impl<'a, X> TidExt<'a> for X where
    X: Tid<'a> + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.