[−][src]Struct symbolic::common::Name
The name of a potentially mangled symbol.
Debugging information often only contains mangled names in their symbol and debug information
data. The mangling schema depends on the compiler and programming language. Name
is a wrapper
type for potentially mangled names and an optionally declared language. To demangle the name,
see the demangle
feature of symbolic
.
Not all sources declare a programming language. In such a case, the language
will be
Unknown
. However, it may still be inferred for demangling by inspecting the mangled string.
Names can refer either functions, types, fields, or virtual constructs. Their semantics are fully defined by the language and the compiler.
Examples
Create a name and print it:
use symbolic_common::Name; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.to_string(), "_ZN3foo3barEv");
Create a name with a language. Alternate formatting prints the language:
use symbolic_common::{Language, Name}; let name = Name::with_language("_ZN3foo3barEv", Language::Cpp); assert_eq!(format!("{:#}", name), "_ZN3foo3barEv [C++]");
Implementations
impl<'a> Name<'a>
[src]
pub fn new<S>(string: S) -> Name<'a> where
S: Into<Cow<'a, str>>,
[src]
S: Into<Cow<'a, str>>,
Constructs a new mangled name.
The language of this name is Language::Unknown
.
Example
use symbolic_common::Name; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.to_string(), "_ZN3foo3barEv");
pub fn with_language<S>(string: S, lang: Language) -> Name<'a> where
S: Into<Cow<'a, str>>,
[src]
S: Into<Cow<'a, str>>,
Constructs a new mangled name with a known Language
.
Example
use symbolic_common::{Language, Name}; let name = Name::with_language("_ZN3foo3barEv", Language::Cpp); assert_eq!(format!("{:#}", name), "_ZN3foo3barEv [C++]");
pub fn as_str(&self) -> &str
[src]
Returns the raw, mangled string of the name.
Example
use symbolic_common::Name; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.as_str(), "_ZN3foo3barEv");
This is also available as an AsRef<str>
implementation:
use symbolic_common::Name; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.as_ref(), "_ZN3foo3barEv");
pub fn language(&self) -> Language
[src]
The language of the mangled symbol.
If the language is not declared in the source, this returns Language::Unknown
. The
language may still be inferred using detect_language
, which is declared on the Demangle
extension trait.
Example
use symbolic_common::{Language, Name}; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.language(), Language::Unknown);
pub fn into_cow(self) -> Cow<'a, str>
[src]
Converts this name into a Cow
, dropping the language.
Example
use symbolic_common::Name; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.into_cow(), "_ZN3foo3barEv");
pub fn into_string(self) -> String
[src]
Converts this name into a String
, dropping the language.
Example
use symbolic_common::Name; let name = Name::new("_ZN3foo3barEv"); assert_eq!(name.into_string(), "_ZN3foo3barEv");
Trait Implementations
impl<'_> AsRef<str> for Name<'_>
[src]
impl<'a> Clone for Name<'a>
[src]
impl<'a> Debug for Name<'a>
[src]
impl<'a> Demangle for Name<'a>
fn detect_language(&self) -> Language
fn demangle(&self, opts: DemangleOptions) -> Option<String>
fn try_demangle(&self, opts: DemangleOptions) -> Cow<'_, str>
impl<'de, 'a> Deserialize<'de> for Name<'a>
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Name<'a>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Name<'a>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<'_> Display for Name<'_>
[src]
impl<'a> Eq for Name<'a>
[src]
impl<'a, S> From<S> for Name<'a> where
S: Into<Cow<'a, str>>,
[src]
S: Into<Cow<'a, str>>,
impl<'a> Hash for Name<'a>
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'_> Into<String> for Name<'_>
[src]
impl<'a, 'b> PartialEq<&'b str> for Name<'a>
[src]
impl<'a, 'b> PartialEq<Cow<'b, str>> for Name<'a>
[src]
fn eq(&self, other: &Cow<'b, str>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<Name<'a>> for Name<'a>
[src]
impl<'a, 'b> PartialEq<String> for Name<'a>
[src]
impl<'a, 'b> PartialEq<str> for Name<'a>
[src]
impl<'a> Serialize for Name<'a>
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
impl<'a> RefUnwindSafe for Name<'a>
impl<'a> Send for Name<'a>
impl<'a> Sync for Name<'a>
impl<'a> Unpin for Name<'a>
impl<'a> UnwindSafe for Name<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,