[−][src]Struct antlr_rust::token_factory::ArenaFactory
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: Debug, T> Debug for ArenaFactory<'input, TF, T>
[src]
impl<'input, TF, T> Default for ArenaFactory<'input, TF, T> where
TF: Default,
[src]
TF: Default,
impl<'input, TF, T> TidAble<'input> for ArenaFactory<'input, TF, T> where
TF: TidAble<'input>,
T: TidAble<'input>,
[src]
TF: TidAble<'input>,
T: TidAble<'input>,
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]
TF: TokenFactory<'input, Tok = Box<Tok>, Inner = Tok>,
Tok: Token<Data = TF::Data> + Clone + TidAble<'input>,
&'a Tok: Default,
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 CharStream
that factory can produce tokens from
pub fn create<T: ?Sized>(
&'input self,
source: Option<&mut T>,
ttype: isize,
text: Option<<Self::Data as ToOwned>::Owned>,
channel: isize,
start: isize,
stop: isize,
line: isize,
column: isize
) -> Self::Tok where
T: CharStream<Self::From>,
[src]
&'input self,
source: Option<&mut T>,
ttype: isize,
text: Option<<Self::Data as ToOwned>::Owned>,
channel: isize,
start: isize,
stop: isize,
line: isize,
column: isize
) -> Self::Tok where
T: CharStream<Self::From>,
pub fn create_invalid() -> &'input Tok
[src]
pub fn get_data(from: Self::From) -> Cow<'input, Self::Data>
[src]
Auto Trait Implementations
impl<'input, TF, T> !RefUnwindSafe for ArenaFactory<'input, TF, T>
[src]
impl<'input, TF, T> Send for ArenaFactory<'input, TF, T> where
T: Send,
TF: Send,
[src]
T: Send,
TF: Send,
impl<'input, TF, T> !Sync for ArenaFactory<'input, TF, T>
[src]
impl<'input, TF, T> Unpin for ArenaFactory<'input, TF, T> where
T: Unpin,
TF: Unpin,
[src]
T: Unpin,
TF: Unpin,
impl<'input, TF, T> UnwindSafe for ArenaFactory<'input, TF, T> where
T: UnwindSafe,
TF: UnwindSafe,
[src]
T: UnwindSafe,
TF: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> NodeText for T
[src]
impl<'a, T> Tid<'a> for T where
T: TidAble<'a> + ?Sized,
[src]
T: TidAble<'a> + ?Sized,
impl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
[src]
X: Tid<'a> + ?Sized,
pub fn is<T>(&self) -> bool where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_rc<T>(self: Rc<X>) -> Result<Rc<T>, Rc<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_arc<T>(self: Arc<X>) -> Result<Arc<T>, Arc<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_box<T>(
self: Box<X, Global>
) -> Result<Box<T, Global>, Box<X, Global>> where
T: Tid<'a>,
[src]
self: Box<X, Global>
) -> Result<Box<T, Global>, Box<X, Global>> where
T: Tid<'a>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,