Function rustc_demangle::demangle

source ·
pub fn demangle(s: &str) -> Demangle<'_>
Expand description

De-mangles a Rust symbol into a more readable version

All Rust symbols by default are mangled as they contain characters that cannot be represented in all object files. The mangling mechanism is similar to C++’s, but Rust has a few specifics to handle items like lifetimes in symbols.

This function will take a mangled symbol and return a value. When printed, the de-mangled version will be written. If the symbol does not look like a mangled symbol, the original value will be written instead.

Examples

use rustc_demangle::demangle;

assert_eq!(demangle("_ZN4testE").to_string(), "test");
assert_eq!(demangle("_ZN3foo3barE").to_string(), "foo::bar");
assert_eq!(demangle("foo").to_string(), "foo");