pub trait TokenFactory<'a>: TidAble<'a> + Sized {
type Inner: Token<Data = Self::Data> + ?Sized + 'a;
type Tok: Borrow<Self::Inner> + Clone + 'a + Debug;
type Data: InputData + ?Sized;
type From;
// Required methods
fn create<T>(
&'a 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> + ?Sized;
fn create_invalid() -> Self::Tok;
fn get_data(from: Self::From) -> Cow<'a, Self::Data>;
}
Expand description
Trait for creating tokens.
Required Associated Types§
Required Methods§
Sourcefn create<T>(
&'a 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
fn create<T>( &'a 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
Creates token either from sourse
or from pure data in text
Either source
or text
are not None
Sourcefn create_invalid() -> Self::Tok
fn create_invalid() -> Self::Tok
Creates invalid token
Invalid tokens must have TOKEN_INVALID_TYPE
token type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.