pub struct PName {
pub raw: IdentOrLiteral,
pub original: String,
pub rename: Option<String>,
}Expand description
A parsed name, which includes the raw name and the effective name.
Examples:
raw = “foo_bar”, no rename rule, effective = “foo_bar” raw = “foo_bar”, #[facet(rename = “kiki”)], effective = “kiki” raw = “foo_bar”, #[facet(rename_all = camelCase)], effective = “fooBar” raw = “r#type”, no rename rule, effective = “type”
Fields§
§raw: IdentOrLiteralThe raw identifier, as we found it in the source code. It might
be actually raw, as in r#keyword.
original: StringIf raw was r#keyword, then this one is, naturally, just keyword.
rename: Option<String>This is original after applying rename rules, which might not be a valid identifier in
Rust. It could be a number. It could be a kebab-case thing. It could be anything!
If it’s None, there was no #[facet(rename)] attr on the field, or #[facet(rename_all)]
on the parent container, and it would’ve been the same as original anyway.
Implementations§
Source§impl PName
impl PName
Sourcepub fn new(
raw: IdentOrLiteral,
container_rename_rule: Option<RenameRule>,
rename: Option<String>,
) -> Self
pub fn new( raw: IdentOrLiteral, container_rename_rule: Option<RenameRule>, rename: Option<String>, ) -> Self
Constructs a new PName.
Precedence for rename:
- Field-level
renameif provided - Container-level
rename_ruleapplied tooriginal - None