Trait symbolic_demangle::Demangle [−][src]
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.
Examples
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:
- The language cannot be detected.
- The language is not supported.
- Demangling of the name failed.
Examples
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.
Examples
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");