Skip to main content

safe_ident

Function safe_ident 

Source
pub fn safe_ident(
    converted: &str,
    original: &str,
    role: &str,
) -> Result<Ident, String>
Expand description

Turn an already case-converted name into a keyword-safe Ident.

Keywords become raw identifiers; names that cannot be a Rust identifier at all (empty, leading digit, illegal characters, or a non-raw-able keyword) return Err with a human-readable reason. original and role are used only to build that message (e.g. role = "operationId").

ยงErrors

Returns Err(reason) when converted cannot name a Rust item.