pub struct Lexeme<StorageT> { /* fields omitted */ }
A Lexeme
represents a segment of the user's input that conforms to a known type. All lexemes
have a starting position in the user's input: lexemes that result from error recovery, however,
do not have a length (or, therefore, an end). This allows us to differentiate between lexemes
that are always of zero length (which are required in some grammars) from lexemes that result
from error recovery (where an error recovery algorithm can know the type that a lexeme should
have been, but can't know what its contents should have been).
Create a new token with ID tok_id
and a starting position in the input start
. If the
token is the result of user input, then Some(n)
should be passed to len
; if the token
is the result of error recovery, then None
should be passed to len
.
Byte offset of the start of the lexeme
Byte offset of the end of the lexeme, or None
if this lexeme is the result of error
recovery.
Length in bytes of the lexeme, or None
if this lexeme is the result of error recovery.
Returns true
if this lexeme is the result of error recovery, or false
otherwise.
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Compare self to key
and return true
if they are equal.
impl<T, U> TryInto for T where U: TryFrom<T>, | |
type Err = <U as TryFrom<T>>::Err