Skip to main content

is_crate_path

Function is_crate_path 

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

Whether a string is usable as the Rust path of a crate: #pragma cinrs crate "…".

A sequence of segments joined by ::, optionally starting with one, where each segment is an identifier — with crate, self and super allowed as segments because a re-export is often reached through one. Deliberately strict: the value is pasted into the expansion as tokens, and anything else there would be a syntax error in generated code rather than a message about the pragma.