Struct proc_macro::SourceFile[][src]

pub struct SourceFile(_);
🔬 This is a nightly-only experimental API. (proc_macro_span #54725)
Expand description

给定 Span 的源文件。

Implementations

🔬 This is a nightly-only experimental API. (proc_macro_span #54725)

获取此源文件的路径。

Note

如果与此 SourceFile 关联的代码范围是由外部宏 (此宏) 生成的,则这可能不是文件系统上的实际路径。 使用 is_real 进行检查。

还要注意,即使 is_real 返回 true,如果在命令行上传递了 --remap-path-prefix,则给定的路径实际上也可能无效。

🔬 This is a nightly-only experimental API. (proc_macro_span #54725)

如果此源文件是真实的源文件,并且不是由外部宏的扩展生成的,则返回 true

Trait Implementations

返回值的副本。 Read more

source 执行复制分配。 Read more

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

此方法测试 selfother 值是否相等,并由 == 使用。 Read 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

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

执行转换。

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

执行转换。