Enum proc_macro::TokenTree1.29.0[][src]

pub enum TokenTree {
    Group(Group),
    Ident(Ident),
    Punct(Punct),
    Literal(Literal),
}
Expand description

单个 token 或 token 树的定界序列 (例如 [1, (), ..])。

Variants

Group(Group)

由括号定界符包围的 token 流。

Ident(Ident)

标识符。

Punct(Punct)

单个标点符号 (+,$ 等)。

Literal(Literal)

字面量字符 ('a'),字符串 ("hello"),数字 (2.3) 等。

Implementations

返回此树的范围,委托给包含的 token 或分隔流的 span 方法。

only this token 配置范围。

请注意,如果此 token 是 Group,则此方法将不会配置每个内部 tokens 的跨度,这将仅委托给每个成员的 set_span 方法。

Trait Implementations

返回值的副本。 Read more

source 执行复制分配。 Read more

以方便调试的形式打印 token 树。

使用给定的格式化程序格式化该值。 Read more

将 token 树打印为应该无损转换为同一 token 树 (取模跨度) 的字符串,但可能带有 Delimiter::None 定界符和负数字字面量的 TokenTree::Group 除外。

使用给定的格式化程序格式化该值。 Read more

用迭代器的内容扩展集合。 Read more

🔬 This is a nightly-only experimental API. (extend_one #72631)

用一个元素扩展一个集合。

🔬 This is a nightly-only experimental API. (extend_one #72631)

在集合中为给定数量的附加元素保留容量。 Read more

执行转换。

执行转换。

执行转换。

执行转换。

创建包含单个 token 树的 token 流。

执行转换。

将多个 token 树收集到单个流中。

从迭代器创建一个值。 Read more

将给定值转换为 StringRead more

Auto Trait Implementations

Blanket Implementations

获取 selfTypeIdRead more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

获得所有权后的结果类型。

通常通过克隆从借用数据中创建拥有的数据。 Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)

recently added

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more

将给定值转换为 StringRead more

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。