Enum TokenTree
pub enum TokenTree
A single token or a delimited sequence of token trees (e.g., [1, (), ..]).
Variants
-
Group(Group) A token stream surrounded by bracket delimiters.
-
Ident(Ident) An identifier.
-
Punct(Punct) A single punctuation character (
+,,,$, etc.).-
Literal(Literal) A literal character (
'a'), string ("hello"), number (2.3), etc.
Implementations
impl TokenTree
fn span(&self) -> SpanReturns the span of this tree, delegating to the
spanmethod of the contained token or a delimited stream.fn set_span(&mut self, span: Span)Configures the span for only this token.
Note that if this token is a
Groupthen this method will not configure the span of each of the internal tokens, this will simply delegate to theset_spanmethod of each variant.
Trait Implementations
impl !Send for TokenTree
impl !Sync for TokenTree
impl Clone for TokenTree
fn clone(&self) -> TokenTree
impl Debug for TokenTree
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for TokenTree
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl From<Group> for TokenTree
fn from(g: Group) -> TokenTree
impl From<Ident> for TokenTree
fn from(g: Ident) -> TokenTree
impl From<Literal> for TokenTree
fn from(g: Literal) -> TokenTree
impl From<Punct> for TokenTree
fn from(g: Punct) -> TokenTree
impl ToTokens for TokenTree
fn to_tokens(&self, tokens: &mut TokenStream)fn into_token_stream(self) -> TokenStream
Auto Trait Implementations
impl Freeze for TokenTree
impl RefUnwindSafe for TokenTree
impl Unpin for TokenTree
impl UnsafeUnpin for TokenTree
impl UnwindSafe for TokenTree
Blanket Implementations
impl<T> Any for TokenTree
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for TokenTree
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for TokenTree
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for TokenTree
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for TokenTree
fn from(t: T) -> TReturns the argument unchanged.
impl<T> RepToTokensExt for TokenTree
where
T: ToTokens + ?Sized,
impl<T> SizeHint for TokenTree
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for TokenTree
impl<T> ToOwned for TokenTree
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for TokenTree
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for TokenTree
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for TokenTree
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for TokenTree
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>