Skip to main content

show_attr_component

Function show_attr_component 

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

Render one path component the way CppNix’s showAttrPath does.

A component is emitted bare iff it matches [A-Za-z_][A-Za-z0-9_'-]* AND is not one of exactly NINE reserved words. Everything else is quoted, with " and newline escaped. Measured bare: a, a1, _a, a-b, a'b, and notably or, true, false, null — which are NOT reserved in this position. Measured quoted: "1a", "a b", "a.b", "", and the nine.