Trait symbolic_demangle::Demangle[][src]

pub trait Demangle {
    fn detect_language(&self) -> Language;
fn demangle(&self, opts: DemangleOptions) -> Option<String>;
fn try_demangle(&self, opts: DemangleOptions) -> Cow<'_, str>; }

An extension trait on Name for demangling names.

See the module level documentation for a list of supported languages.

Required methods

fn detect_language(&self) -> Language[src]

Infers the language of a mangled name.

In case the symbol is not mangled or its language is unknown, the return value will be Language::Unknown. If the language of the symbol was specified explicitly, this is returned instead. For a list of supported languages, see the module level documentation.


use symbolic_common::{Name, Language};
use symbolic_demangle::{Demangle, DemangleOptions};

assert_eq!(Name::from("_ZN3foo3barEv").detect_language(), Language::Cpp);
assert_eq!(Name::from("unknown").detect_language(), Language::Unknown);

fn demangle(&self, opts: DemangleOptions) -> Option<String>[src]

Demangles the name with the given options.

Returns None in one of the following cases:

  1. The language cannot be detected.
  2. The language is not supported.
  3. Demangling of the name failed.


use symbolic_common::Name;
use symbolic_demangle::{Demangle, DemangleOptions};

assert_eq!(Name::from("_ZN3foo3barEv").demangle(DemangleOptions::name_only()), Some("foo::bar".to_string()));
assert_eq!(Name::from("unknown").demangle(DemangleOptions::name_only()), None);

fn try_demangle(&self, opts: DemangleOptions) -> Cow<'_, str>[src]

Tries to demangle the name and falls back to the original name.

Similar to demangle, except that it returns a borrowed instance of the original name if the name cannot be demangled.


use symbolic_common::Name;
use symbolic_demangle::{Demangle, DemangleOptions};

assert_eq!(Name::from("_ZN3foo3barEv").try_demangle(DemangleOptions::name_only()), "foo::bar");
assert_eq!(Name::from("unknown").try_demangle(DemangleOptions::name_only()), "unknown");
Loading content...

Implementations on Foreign Types

impl<'a> Demangle for Name<'a>[src]

Loading content...


Loading content...