Skip to main content

portable_path

Function portable_path 

Source
pub fn portable_path(file: &str) -> String
Expand description

Render a source path with / separators on every platform. 在任何平台上都以 / 分隔符渲染源码路径。

file!() records the platform separator, and a declaration cannot rewrite it at compile time without allocating, so the portable form is produced when a path is displayed or compared instead. Identity is unaffected: hashing folds both separators to the same byte. file!() 记录平台分隔符,而声明在编译期无法在不分配的前提下改写它,因此改为 在显示或比较时产出可移植形式。身份不受影响:哈希会把两种分隔符折叠为同一字节。