Skip to main content

trim_source_path

Function trim_source_path 

Source
pub fn trim_source_path(path: &str) -> &str
Expand description

Returns the part of a file!() path worth sending: a suffix of path, so no allocation.

Relative paths (workspace members) are unchanged. Absolute paths into the cargo registry lose everything through the index directory, git checkouts lose everything through git/checkouts/, and any other absolute path is reduced to its file name. Both / and \ separate components, because the path comes from the build host, which may differ from the target.