Enum TokenText Copy item path Source pub enum TokenText {
Slice {
source: Arc <str >,
range: Range <usize >,
},
Owned(Arc <str >),
Static(&'static str ),
}
Expand description Representation for the textual payload of a Token
.
Tokens may either borrow slices from the input stream or own standalone
strings that were generated during macro expansion. The enum keeps track of
the data’s lifetime and enables zero-copy lexing for most tokens.
Borrowed slice from an input string.
Fields Shared reference to the original input.
Range of the slice within the source string.
Heap allocated string stored in an Arc
.
Creates a borrowed slice from an input Arc<str>
.
Returns the string slice represented by this token.
Returns the length in bytes of the token text.
Returns true
when the token text is empty.
Converts the token text into an owned String
.
Clone into a given string buffer.
Performs copy-assignment from
source
.
Read more Formats the value using the given formatter.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit
)
Performs copy-assignment from
self
to
dest
.
Read more Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From <T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.