Skip to main content

escape_mod_ident

Function escape_mod_ident 

Source
pub fn escape_mod_ident(name: &str) -> String
Expand description

Escape a proto package segment for use as a Rust mod name.

Returns r# prefix for raw-able keywords, _ suffix for path-position keywords (which can’t be raw), and the name as-is otherwise.

This is a String (not Ident) because callers typically emit it into source text (e.g. pub mod {name} { ... } via format!), not via quote!.