pub fn readable_name(raw: &str) -> StringExpand description
Returns a readable name from a raw identifier that may be a Clang USR.
§USR format
USRs follow the pattern c:…@…@name#…. The last @‑delimited segment
contains the symbol’s base name, optionally followed by #… encoding
template arguments and qualifiers.
§Strategy
- If
rawdoes not contain@, it is already a plain name and is returned unchanged. - Otherwise, the substring after the last
@is taken. - Everything from the first
#in that substring is discarded.
§Examples
assert_eq!(readable_name("c:@F@main"), "main");
assert_eq!(readable_name("c:@S@MyClass@F@method"), "method");
assert_eq!(
readable_name("c:@S@MyClass@F@MyClass#&1$@S@MyClass#"),
"MyClass"
);
assert_eq!(readable_name("already_clean"), "already_clean");
assert_eq!(readable_name(""), "");