Function rustc_demangle::demangle [] [src]

pub fn demangle(s: &str) -> Demangle

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 (typically acquired from a Symbol which is in turn resolved from a Frame) and then writes the de-mangled version into the given writer. If the symbol does not look like a mangled symbol, it is still written to writer.

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");