# Crate rustc_demangle [−] [src]

Demangle Rust compiler symbol names.

This crate provides a `demangle` function which will return a `Demangle` sentinel value that can be used to learn about the demangled version of a symbol name. The demangled representation will be the same as the original if it doesn't look like a mangled symbol name.

`Demangle` can be formatted with the `Display` trait. The alternate modifier (`#`) can be used to format the symbol name without the trailing hash value.

# 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");
    // With hash
    assert_eq!(format!("{}", demangle("_ZN3foo17h05af221e174051e9E")), "foo::h05af221e174051e9");
    // Without hash
    assert_eq!(format!("{:#}", demangle("_ZN3foo17h05af221e174051e9E")), "foo");

## Structs

Demangle | Representation of a demangled symbol name.
TryDemangleError | Error returned from the `try_demangle` function below when demangling fails.

## Functions

demangle | De-mangles a Rust symbol into a more readable version
try_demangle | The same as `demangle`, except return an `Err` if the string does not appear to be a Rust symbol, rather than "demangling" the given string as a no-op.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)